Google Benchmark, clang++ different results for pc and mac?

73 views
Skip to first unread message

Ivan Zvonimir Horvat

unread,
Apr 8, 2019, 8:56:06 AM4/8/19
to benchmark-discuss
I was trying the google benchmark example from CppCon Chandler Carruth and I have completely different results (for vector reserve) on OsX and PC(running linux), and I am not sure why? 
https://github.com/Horki/benchtest

static void bench_reserve(benchmark::State &state) {
 
while (state.KeepRunning()) {
    vector
<int> v;
    v
.reserve(1);
 
}
}
BENCHMARK
(bench_reserve);



Os X

Run on (8 X 2200 MHz CPU s)
CPU
Caches:
L1
Data 32K (x4)
L1
Instruction 32K (x4)
L2
Unified 262K (x4)
L3
Unified 6291K (x1)
-------------------------------------------------------
Benchmark Time CPU Iterations
-------------------------------------------------------
bench_create
0 ns 0 ns 1000000000
bench_reserve
0 ns 0 ns 1000000000
bench_push_back
2 ns 2 ns 355207340




Arch Linux

Run on (8 X 4000 MHz CPU s)
CPU
Caches:
L1
Data 32K (x4)
L1
Instruction 32K (x4)
L2
Unified 256K (x4)
L3
Unified 8192K (x1)
Load Average: 0.05, 0.12, 0.15
----------------------------------------------------------
Benchmark Time CPU Iterations
----------------------------------------------------------
bench_create
0.266 ns 0.266 ns 1000000000
bench_reserve
9.59 ns 9.59 ns 69819729
bench_push_back
9.58 ns 9.58 ns 73438758


Roman Lebedev

unread,
Apr 8, 2019, 9:32:00 AM4/8/19
to Ivan Zvonimir Horvat, benchmark-discuss
For starters, you have different bechmark lib versions.
(int)0.266 == 0, so the numbers could match.

Other than that, there is any number of reasons why the exact same benchmark
would be producing different results, starting with system load,
compiler version, used compiler flags, system load,
and the phase of the moon.

In general, you can't really compare benchmarking results
from any two different environments.


Roman.

> --
> You received this message because you are subscribed to the Google Groups "benchmark-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to benchmark-disc...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages