Skip to content

Commit a1fe973

Browse files
committed
Include performance file and results
1 parent a481675 commit a1fe973

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
// (C) Copyright Matt Borland 2022.
2+
// Use, modification and distribution are subject to the
3+
// Boost Software License, Version 1.0. (See accompanying file
4+
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5+
6+
#include <boost/math/special_functions/next.hpp>
7+
#include <benchmark/benchmark.h>
8+
9+
template <typename T>
10+
void float_distance(benchmark::State& state)
11+
{
12+
const auto difference = static_cast<int>(state.range(0));
13+
T left = 2;
14+
T right = boost::math::float_advance(left, difference);
15+
16+
for (auto _ : state)
17+
{
18+
benchmark::DoNotOptimize(boost::math::float_distance(left, right));
19+
}
20+
state.SetComplexityN(state.range(0));
21+
}
22+
23+
BENCHMARK_TEMPLATE(float_distance, float)->RangeMultiplier(2)->Range(1 << 1, 1 << 14)->Complexity()->UseRealTime();
24+
BENCHMARK_TEMPLATE(float_distance, double)->RangeMultiplier(2)->Range(1 << 1, 1 << 14)->Complexity()->UseRealTime();
25+
26+
BENCHMARK_MAIN();
27+
28+
/*
29+
Run on Apple M1 Pro Arch using Apple Clang 14.0.0 (15OCT22)
30+
31+
Original performance (Boost 1.80.0):
32+
33+
Unable to determine clock rate from sysctl: hw.cpufrequency: No such file or directory
34+
This does not affect benchmark measurements, only the metadata output.
35+
2022-10-15T15:24:07-07:00
36+
Running ./new_next_performance
37+
Run on (10 X 24.0916 MHz CPU s)
38+
CPU Caches:
39+
L1 Data 64 KiB
40+
L1 Instruction 128 KiB
41+
L2 Unified 4096 KiB (x10)
42+
Load Average: 1.86, 2.53, 5.83
43+
---------------------------------------------------------------------------------
44+
Benchmark Time CPU Iterations
45+
---------------------------------------------------------------------------------
46+
float_distance<float>/2/real_time 61.4 ns 61.4 ns 9074469
47+
float_distance<float>/4/real_time 61.7 ns 61.7 ns 11384150
48+
float_distance<float>/8/real_time 61.4 ns 61.4 ns 10814604
49+
float_distance<float>/16/real_time 61.7 ns 61.7 ns 11348376
50+
float_distance<float>/32/real_time 61.4 ns 61.4 ns 11387167
51+
float_distance<float>/64/real_time 61.6 ns 61.6 ns 11131932
52+
float_distance<float>/128/real_time 61.4 ns 61.4 ns 11382029
53+
float_distance<float>/256/real_time 61.4 ns 61.4 ns 11307649
54+
float_distance<float>/512/real_time 61.4 ns 61.4 ns 11376048
55+
float_distance<float>/1024/real_time 61.4 ns 61.4 ns 11355748
56+
float_distance<float>/2048/real_time 61.8 ns 61.8 ns 11373776
57+
float_distance<float>/4096/real_time 61.4 ns 61.4 ns 11382368
58+
float_distance<float>/8192/real_time 61.4 ns 61.4 ns 11353453
59+
float_distance<float>/16384/real_time 61.4 ns 61.4 ns 11378298
60+
float_distance<float>/real_time_BigO 61.48 (1) 61.47 (1)
61+
float_distance<float>/real_time_RMS 0 % 0 %
62+
float_distance<double>/2/real_time 55.6 ns 55.6 ns 12580218
63+
float_distance<double>/4/real_time 55.6 ns 55.6 ns 12577835
64+
float_distance<double>/8/real_time 55.6 ns 55.6 ns 12564909
65+
float_distance<double>/16/real_time 56.2 ns 56.2 ns 12554909
66+
float_distance<double>/32/real_time 56.0 ns 56.0 ns 12544381
67+
float_distance<double>/64/real_time 55.6 ns 55.6 ns 12566488
68+
float_distance<double>/128/real_time 55.6 ns 55.6 ns 12499581
69+
float_distance<double>/256/real_time 55.6 ns 55.6 ns 12565661
70+
float_distance<double>/512/real_time 56.1 ns 56.1 ns 12550023
71+
float_distance<double>/1024/real_time 55.8 ns 55.8 ns 12568603
72+
float_distance<double>/2048/real_time 55.6 ns 55.6 ns 12546049
73+
float_distance<double>/4096/real_time 55.6 ns 55.6 ns 12528525
74+
float_distance<double>/8192/real_time 55.9 ns 55.9 ns 12563030
75+
float_distance<double>/16384/real_time 56.0 ns 56.0 ns 12447644
76+
float_distance<double>/real_time_BigO 55.78 (1) 55.78 (1)
77+
float_distance<double>/real_time_RMS 0 % 0 %
78+
79+
New performance:
80+
81+
Unable to determine clock rate from sysctl: hw.cpufrequency: No such file or directory
82+
This does not affect benchmark measurements, only the metadata output.
83+
2022-10-15T15:31:37-07:00
84+
Running ./new_next_performance
85+
Run on (10 X 24.122 MHz CPU s)
86+
CPU Caches:
87+
L1 Data 64 KiB
88+
L1 Instruction 128 KiB
89+
L2 Unified 4096 KiB (x10)
90+
Load Average: 2.12, 2.17, 4.26
91+
---------------------------------------------------------------------------------
92+
Benchmark Time CPU Iterations
93+
---------------------------------------------------------------------------------
94+
float_distance<float>/2/real_time 15.8 ns 15.8 ns 42162717
95+
float_distance<float>/4/real_time 15.9 ns 15.9 ns 44213877
96+
float_distance<float>/8/real_time 15.8 ns 15.8 ns 43972542
97+
float_distance<float>/16/real_time 15.8 ns 15.8 ns 44209456
98+
float_distance<float>/32/real_time 15.8 ns 15.8 ns 44200244
99+
float_distance<float>/64/real_time 15.8 ns 15.8 ns 44239293
100+
float_distance<float>/128/real_time 15.8 ns 15.8 ns 44171202
101+
float_distance<float>/256/real_time 15.8 ns 15.8 ns 44241507
102+
float_distance<float>/512/real_time 15.9 ns 15.8 ns 44230034
103+
float_distance<float>/1024/real_time 15.8 ns 15.8 ns 44241554
104+
float_distance<float>/2048/real_time 15.8 ns 15.8 ns 44220802
105+
float_distance<float>/4096/real_time 15.8 ns 15.8 ns 44220441
106+
float_distance<float>/8192/real_time 15.9 ns 15.9 ns 44213994
107+
float_distance<float>/16384/real_time 15.8 ns 15.8 ns 44215413
108+
float_distance<float>/real_time_BigO 15.83 (1) 15.83 (1)
109+
float_distance<float>/real_time_RMS 0 % 0 %
110+
float_distance<double>/2/real_time 15.5 ns 15.5 ns 45098165
111+
float_distance<double>/4/real_time 15.6 ns 15.6 ns 45065465
112+
float_distance<double>/8/real_time 15.5 ns 15.5 ns 45058733
113+
float_distance<double>/16/real_time 15.8 ns 15.7 ns 45078404
114+
float_distance<double>/32/real_time 15.5 ns 15.5 ns 44832734
115+
float_distance<double>/64/real_time 15.5 ns 15.5 ns 45077303
116+
float_distance<double>/128/real_time 15.5 ns 15.5 ns 45067255
117+
float_distance<double>/256/real_time 15.5 ns 15.5 ns 45073844
118+
float_distance<double>/512/real_time 15.6 ns 15.6 ns 45109342
119+
float_distance<double>/1024/real_time 15.5 ns 15.5 ns 44845180
120+
float_distance<double>/2048/real_time 15.5 ns 15.5 ns 45051846
121+
float_distance<double>/4096/real_time 15.5 ns 15.5 ns 45064317
122+
float_distance<double>/8192/real_time 15.5 ns 15.5 ns 45115653
123+
float_distance<double>/16384/real_time 15.5 ns 15.5 ns 45067642
124+
float_distance<double>/real_time_BigO 15.54 (1) 15.54 (1)
125+
float_distance<double>/real_time_RMS 0 % 0 %
126+
*/

0 commit comments

Comments
 (0)