summaryrefslogtreecommitdiff
path: root/libc/test/src/math/performance_testing/sqrtf128_perf.cpp
AgeCommit message (Collapse)Author
2025-04-24[libc][math] Improve performance test framework (#134501)Tejas Vipin
- Merges `BinaryOpSingleOutputPerf.h` and `SingleInputSingleOutputPerf.h` files into a unified `PerfTest.h` and update all performance tests to use this. - Improve the output printed to log file for tests. - Removes unused `run_diff` method and redundant `run_perf` call in `BINARY_INPUT_SINGLE_OUTPUT_PERF_EX` (previously `BINARY_OP_SINGLE_OUTPUT_PERF_EX`) - Change `BINARY_INPUT_SINGLE_OUTPUT_PERF_EX` and `SINGLE_INPUT_SINGLE_OUTPUT_PERF` to not define `main`
2025-02-13[libc][math] Improve the performance of sqrtf128. (#122578)lntue
Use a combination of polynomial approximation and Newton-Raphson iterations in 64-bit and 128-bit integers to improve the performance of sqrtf128. The correct rounding is provided by squaring the result and comparing it with the argument. Performance improvement using the newly added perf test: - My function = the improved implementation from this PR - Other function = current implementation using `libc/src/__support/FPUtil/generic/sqrt.h` ``` Performance tests with inputs in denormal range: -- My function -- Total time : 1260765265 ns Average runtime : 125.951 ns/op Ops per second : 7939623 op/s -- Other function -- Total time : 7160726518 ns Average runtime : 715.357 ns/op Ops per second : 1397902 op/s -- Average runtime ratio -- Mine / Other's : 0.176067 Performance tests with inputs in normal range: -- My function -- Total time : 373003808 ns Average runtime : 37.2631 ns/op Ops per second : 26836189 op/s -- Other function -- Total time : 7353398916 ns Average runtime : 734.605 ns/op Ops per second : 1361275 op/s -- Average runtime ratio -- Mine / Other's : 0.0507254 ``` --------- Co-authored-by: Alexei Sibidanov <sibid@uvic.ca>