boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
313 stars 74 forks source link

Improve axis regular precision #387

Open ryanelandt opened 1 year ago

ryanelandt commented 1 year ago

This PR refactors regular axis to address the issues described in #336 by incorporating some of the ideas from #386. This PR adds a unit that verifies exact indexing for various cases.

The output of ./benchmark_axis_index before the refactor:

Benchmark                         Time             CPU   Iterations
-------------------------------------------------------------------
regular<uniform>               1.31 ns         1.31 ns    538240574
regular<normal>                2.00 ns         2.00 ns    351784388
circular<uniform>              1.62 ns         1.62 ns    432490637
circular<normal>               1.62 ns         1.62 ns    424151491

The output of ./benchmark_axis_index after the refactor:

Benchmark                         Time             CPU   Iterations
-------------------------------------------------------------------
regular<uniform>               1.13 ns         1.13 ns    578725526
regular<normal>                1.71 ns         1.71 ns    399524265
circular<uniform>              1.51 ns         1.51 ns    471027721
circular<normal>               1.49 ns         1.49 ns    459937000
ryanelandt commented 1 year ago

This PR does not change the public API, but it does change private class members that are not user accessible. Modifying private class members has implications for serialization. Is this type of PR problematic in regards to Boost API stability?