Comparison
Feature comparison based on kd3 1.5.0 and nanoflann 1.10.0. kd3 targets static low-dimensional clouds; nanoflann covers a broader feature set. Colors indicate advantage in this comparison, not simply whether a feature exists.
kd3 is stronger for
- Static 2D-4D point clouds, especially near-data queries.
- Volume and ray queries when subtree bounds are enabled.
- First-class filtered 1-NN, k-NN, and distance queries.
- Caller-owned k-NN buffers and a trivially copyable view.
- C API, GLSL generator, and header-only C++23.
nanoflann is stronger for
- Radius, approximate, and custom-metric search.
- Dynamic, incremental, and runtime-dimensional indexes.
- Non-owning adaptors and built-in index serialization.
- C++11 compatibility and no OpenMP requirement.
- A permissive BSD licence and a mature ecosystem.
| Capability | kd3 1.5 | nanoflann 1.10 |
|---|---|---|
| Index and search | ||
| Static kd-tree | Yes | Yes |
| Dynamic add/remove | No | Yes |
| Incremental / self-balancing tree | No | Yes |
| Async / multi-threaded incremental variant | No | Yes |
| Compile-time dimensionality | Yes | Yes |
| Runtime dimensionality | No | Yes |
| 1-NN | Yes | Yes |
| k-NN | Yes | Yes |
| Radius search | No | Yes |
| Radius-limited k-NN | No | Yes |
| Approximate search | No | Yes |
| Custom result set | No | Yes |
| Custom distance metric | No | Yes |
| Filtered queries | Yes | Partial |
| Ray / cylinder query | Yes | No |
| Tie-break control | No | Yes |
| Parallel build | Yes | Limited |
| Index serialization | Buffer copy | Yes |
| Query-time allocation | None | DIM-dependent |
| Data, layout, and API | ||
| Data ownership | Owning | Non-owning |
| Mutates input during build | Yes | No |
| Arbitrary data source / adaptor | No | Yes |
| SoA leaf layout | Yes | No |
| Hand-written SIMD kernels | Opt-in | No |
| Per-subtree AABB toggle | Yes | No |
| Trivially copyable query view | Yes | No |
| Built-in C API | Yes | No |
| GLSL / shader generator | Yes | No |
| Header-only | Yes | Yes |
| Required C++ standard | C++23 | C++11 |
| OpenMP required | Build-time | No |
| Licence | AGPL-3.0-only or commercial | BSD-2-Clause |
| Primary tuning target | Static low-D | General-purpose |
Performance is configuration-dependent. kd3 wins clearly on near-data queries and on volume queries with AABB enabled; nanoflann remains the broader library. nanoflann's parallel build is present, but a global lock limits scalability. The benchmark page lists every measured row.
kd3 is a static index. The repository includes a small compaction-based mutable wrapper in examples/mutable with an optional delta tree and bulk creation. It adds insert/erase/kNN around KdTreeView without changing the core index. The mutable benchmark validates it against nanoflann's dynamic adaptors. Dynamic support is not built in, but the wrapper is deliberately small.