Skip to content

Speed up NDT bucket lookup with a dense hash map#324

Merged
JanuszBedkowski merged 3 commits into
MapsHD:mainfrom
bloom256:perf/optimize_lidar_odometry_3
Jan 21, 2026
Merged

Speed up NDT bucket lookup with a dense hash map#324
JanuszBedkowski merged 3 commits into
MapsHD:mainfrom
bloom256:perf/optimize_lidar_odometry_3

Conversation

@bloom256
Copy link
Copy Markdown
Collaborator

This PR improves performance of NDT bucket storage and lookup by replacing std::unordered_map with ankerl::unordered_dense::map.

Rationale:

  • ankerl::unordered_dense::map is more cache-friendly, faster for lookups, and more memory-efficient than std::unordered_map.
  • The container provides different iterator/reference lifetime guarantees, but no code paths were found that rely on iterator or reference stability.

Alternatives considered:

  • absl::flat_hash_map was tested but showed lower performance in this use case.
  • robin_hood::unordered_flat_map was also evaluated, but its API is incompatible and would require a larger refactor.

Licensing:

  • ankerl::unordered_dense is MIT-licensed.

Performance:

  • ~10% speedup observed in compute_step_2 compared to the previous version.

Notes:

  • This is a data-structure substitution only; algorithmic behavior and the mathematical model are unchanged.

@JanuszBedkowski
Copy link
Copy Markdown
Member

please solve build failed Build Python Bindings on Linux / build (3.12) (pull_request)

@bloom256
Copy link
Copy Markdown
Collaborator Author

please solve build failed Build Python Bindings on Linux / build (3.12) (pull_request)

Done

@JanuszBedkowski JanuszBedkowski merged commit a990099 into MapsHD:main Jan 21, 2026
6 checks passed
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.

2 participants