Skip to content

Conversation

@mlourakis
Copy link

Revised the unrolled loops in L1 & L2 distance calculations (L[12]_Adaptor):

  • eliminated data dependency on d++
  • added separate control paths depending on worst_dist
  • unrolled processing of trailing elements with a fall-through switch

Additionally:

  • added inline, constexpr, noexcept, __restrict specifiers
  • added unit tests for L1
  • other minor changes

mlourakis added 3 commits December 1, 2025 18:21
revised unrolled loops in evalMetric() for L1/L2; added tests for L1
mainly inline & noexcept plus a few misc changes
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

❌ Patch coverage is 72.72727% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.25%. Comparing base (d8bfec8) to head (79c20b1).
⚠️ Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
include/nanoflann.hpp 72.72% 21 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #277      +/-   ##
==========================================
- Coverage   86.20%   84.25%   -1.96%     
==========================================
  Files           1        1              
  Lines         667      705      +38     
  Branches      125      130       +5     
==========================================
+ Hits          575      594      +19     
- Misses         92      111      +19     
Files with missing lines Coverage Δ
include/nanoflann.hpp 84.25% <72.72%> (-1.96%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@jlblancoc jlblancoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks a lot! 👏

Please, see my minor comments above.

@jlblancoc
Copy link
Owner

@mlourakis LGTM, thanks again for the contribution!

On alignment: totally agree. Your comments are perfect as is now.
We could add macros to auto-detect the enabled compiler flags (SSE*, AVX*, etc.) and architecture and define the alignment accordingly... my only fear is it might become ABI incompatible (-> crashes) if at some point nanoflann.hpp is included from two translation units with different compiler flags (same problem happened with Eigen3 in the past... 😢 ).

@jlblancoc jlblancoc merged commit ce38bbd into jlblancoc:master Dec 4, 2025
7 of 9 checks passed
@mlourakis
Copy link
Author

Fully agree about autodetecting the HW details, that's one of the reasons I was reluctant to attempt it. But someone interested in getting the best possible performance, might choose to tweak alignment on his own machine.

Thanks for your work on nanoflann!

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