Skip to content

Commit

Permalink
refactor: Remove quick math helpers (#3701)
Browse files Browse the repository at this point in the history
This has proven not to be useful as `std` math functions are not really a bottleneck in our current code. I propose to remove them here. If they become useful in the future we can just bring them back from here.
  • Loading branch information
andiwand authored Oct 9, 2024
1 parent 69e0b6b commit e6400b6
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 264 deletions.
9 changes: 1 addition & 8 deletions Core/include/Acts/Propagator/EigenStepper.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "Acts/Propagator/ConstrainedStep.hpp"
#include "Acts/Propagator/EigenStepperError.hpp"
#include "Acts/Propagator/detail/CovarianceEngine.hpp"
#include "Acts/Utilities/QuickMath.hpp"

#include <limits>

Expand Down Expand Up @@ -177,17 +176,11 @@ Acts::Result<double> Acts::EigenStepper<E>::step(
// This is given by the order of the Runge-Kutta method
constexpr double exponent = 0.25;

// Whether to use fast power function if available
constexpr bool tryUseFastPow{false};

double x = state.options.stepping.stepTolerance / errorEstimate_;

if constexpr (exponent == 0.25 && !tryUseFastPow) {
if constexpr (exponent == 0.25) {
// This is 3x faster than std::pow
x = std::sqrt(std::sqrt(x));
} else if constexpr (std::numeric_limits<double>::is_iec559 &&
tryUseFastPow) {
x = fastPow(x, exponent);
} else {
x = std::pow(x, exponent);
}
Expand Down
90 changes: 0 additions & 90 deletions Core/include/Acts/Utilities/QuickMath.hpp

This file was deleted.

9 changes: 1 addition & 8 deletions Core/src/Propagator/SympyStepper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include "Acts/Propagator/detail/SympyCovarianceEngine.hpp"
#include "Acts/Propagator/detail/SympyJacobianEngine.hpp"
#include "Acts/Utilities/QuickMath.hpp"

#include <cmath>
#include <cstdint>
Expand Down Expand Up @@ -127,17 +126,11 @@ Result<double> SympyStepper::stepImpl(
// This is given by the order of the Runge-Kutta method
constexpr double exponent = 0.25;

// Whether to use fast power function if available
constexpr bool tryUseFastPow{false};

double x = stepTolerance / errorEstimate_;

if constexpr (exponent == 0.25 && !tryUseFastPow) {
if constexpr (exponent == 0.25) {
// This is 3x faster than std::pow
x = std::sqrt(std::sqrt(x));
} else if constexpr (std::numeric_limits<double>::is_iec559 &&
tryUseFastPow) {
x = fastPow(x, exponent);
} else {
x = std::pow(x, exponent);
}
Expand Down
1 change: 0 additions & 1 deletion Tests/Benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ add_benchmark(SurfaceIntersection SurfaceIntersectionBenchmark.cpp)
add_benchmark(RayFrustum RayFrustumBenchmark.cpp)
add_benchmark(AnnulusBounds AnnulusBoundsBenchmark.cpp)
add_benchmark(StraightLineStepper StraightLineStepperBenchmark.cpp)
add_benchmark(QuickMath QuickMathBenchmark.cpp)
add_benchmark(SympyStepper SympyStepperBenchmark.cpp)
add_benchmark(Stepper StepperBenchmark.cpp)
add_benchmark(SourceLink SourceLinkBenchmark.cpp)
92 changes: 0 additions & 92 deletions Tests/Benchmarks/QuickMathBenchmark.cpp

This file was deleted.

1 change: 0 additions & 1 deletion Tests/UnitTests/Core/Utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ target_compile_definitions(
add_unittest(ParticleData ParticleDataTests.cpp)
add_unittest(Zip ZipTests.cpp)
add_unittest(TransformRange TransformRangeTests.cpp)
add_unittest(QuickMath QuickMathTests.cpp)

add_unittest(TrackHelpers TrackHelpersTests.cpp)
add_unittest(GraphViz GraphVizTests.cpp)
64 changes: 0 additions & 64 deletions Tests/UnitTests/Core/Utilities/QuickMathTests.cpp

This file was deleted.

0 comments on commit e6400b6

Please sign in to comment.