Skip to content

Feature/bench kdtree flann vs nanoflann#6438

Open
rtkartista wants to merge 2 commits intoPointCloudLibrary:masterfrom
rtkartista:feature/bench-kdtree-flann-vs-nanoflann
Open

Feature/bench kdtree flann vs nanoflann#6438
rtkartista wants to merge 2 commits intoPointCloudLibrary:masterfrom
rtkartista:feature/bench-kdtree-flann-vs-nanoflann

Conversation

@rtkartista
Copy link
Copy Markdown

Closes #3860 (partial — search module benchmark)

What

Adds the first benchmark to the search module: benchmarks/search/bench_kdtree.cpp

Benchmarks pcl::search::KdTree (FLANN) vs pcl::search::KdTreeNanoflann
across three axes:

  • Tree construction: 10k / 100k / 500k points
  • kNN query: k = 1, 5, 20, 50
  • Radius search: r = 5, 10, 20 m

Results

Hardware: 12 threads / Ubuntu 24.04 / GCC 13 / -O3 -mavx2
Cloud: table_scene_mug_stereo_textured.pcd (307,200 pts) for query benchmarks;
synthetic uniform random for build benchmarks
Repetitions: 3 — mean reported

absolute timings may vary slightly

Tree construction (ms, lower is better)

Points FLANN (ms) nanoflann (ms) Speedup
10k 1.15 0.979 1.17×
100k 16.2 13.1 1.24×
500k 129 94.4 1.37×

kNN query (µs, lower is better)

k FLANN (µs) nanoflann (µs) Speedup
1 0.831 0.244 3.41×
5 1.43 0.466 3.07×
20 2.18 0.912 2.39×
50 5.10 2.97 1.72×

Radius search (µs, lower is better)

radius (m) FLANN (µs) nanoflann (µs) Speedup
5 12,735 1,521 8.37×
10 12,991 1,536 8.46×
20 13,244 1,539 8.60×

nanoflann is 1.2–1.4× faster to build, 1.7–3.4× faster on kNN, and
8.4× faster on radius search
— making it the clear default for
localization and mapping pipelines that call radiusSearch in tight loops
(normal estimation, ICP, GICP, NDT).

Notes

  • Accepts optional PCD path as argv[1]; falls back to synthetic 100k-pt cloud
  • nanoflann benchmarks compiled in automatically when PCL_HAS_NANOFLANN is defined
  • Ready to extend with registration / features benchmarks in follow-up PRs

rtkartista and others added 2 commits May 6, 2026 12:17
Closes PointCloudLibrary#3860 (partial — search module benchmark)

Adds benchmarks/search/bench_kdtree.cpp covering tree construction,
kNN query, and radius search for pcl::search::KdTree (FLANN) vs
pcl::search::KdTreeNanoflann (added in 1.15.1 / PointCloudLibrary#6250).

Results on Legion 5 / i7-10750H / Ubuntu 24.04 / GCC 13 / Release:
- Build 500k pts: 134 ms (FLANN)
- kNN k=1: 0.875 us, k=20: 2.34 us (FLANN)
- Radius r=5m: 13,049 us (FLANN)

Benchmark skips silently if google-benchmark is not installed.
Accepts optional PCD path as argv[1], falls back to synthetic cloud.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add benchmarks to PCL

1 participant