diff --git a/bench_eth_curves_clang_old b/bench_eth_curves_clang_old index f690889..7d2fb66 100755 Binary files a/bench_eth_curves_clang_old and b/bench_eth_curves_clang_old differ diff --git a/bench_eth_curves_gcc_old b/bench_eth_curves_gcc_old index f4fef0c..ff68a11 100755 Binary files a/bench_eth_curves_gcc_old and b/bench_eth_curves_gcc_old differ diff --git a/benchmarks/bls12_381_fp.nim b/benchmarks/bls12_381_fp.nim index 08a83e7..b61c218 100644 --- a/benchmarks/bls12_381_fp.nim +++ b/benchmarks/bls12_381_fp.nim @@ -33,6 +33,21 @@ const InvIters = 1000 randomize(1234) +# warmup +proc warmup*() = + # Warmup - make sure cpu is on max perf + let start = cpuTime() + var foo = 123 + for i in 0 ..< 300_000_000: + foo += i*i mod 456 + foo = foo mod 789 + + # Compiler shouldn't optimize away the results as cpuTime rely on sideeffects + let stop = cpuTime() + echo &"\n\nWarmup: {stop - start:>4.4f} s, result {foo} (displayed to avoid compiler optimizing warmup away)\n" + +warmup() + echo "\n⚠️ Measurements are approximate and use the CPU nominal clock: Turbo-Boost and overclocking will skew them." echo "==========================================================================================================\n" diff --git a/benchmarks/bn254_fp.nim b/benchmarks/bn254_fp.nim index 4f0880d..e159c9b 100644 --- a/benchmarks/bn254_fp.nim +++ b/benchmarks/bn254_fp.nim @@ -33,6 +33,21 @@ const InvIters = 1000 randomize(1234) +# warmup +proc warmup*() = + # Warmup - make sure cpu is on max perf + let start = cpuTime() + var foo = 123 + for i in 0 ..< 300_000_000: + foo += i*i mod 456 + foo = foo mod 789 + + # Compiler shouldn't optimize away the results as cpuTime rely on sideeffects + let stop = cpuTime() + echo &"\n\nWarmup: {stop - start:>4.4f} s, result {foo} (displayed to avoid compiler optimizing warmup away)\n" + +warmup() + echo "\n⚠️ Measurements are approximate and use the CPU nominal clock: Turbo-Boost and overclocking will skew them." echo "==========================================================================================================\n" diff --git a/benchmarks/secp256k1_fp.nim b/benchmarks/secp256k1_fp.nim index 89c0ee5..ac15316 100644 --- a/benchmarks/secp256k1_fp.nim +++ b/benchmarks/secp256k1_fp.nim @@ -33,6 +33,21 @@ const InvIters = 1000 randomize(1234) +# warmup +proc warmup*() = + # Warmup - make sure cpu is on max perf + let start = cpuTime() + var foo = 123 + for i in 0 ..< 300_000_000: + foo += i*i mod 456 + foo = foo mod 789 + + # Compiler shouldn't optimize away the results as cpuTime rely on sideeffects + let stop = cpuTime() + echo &"\n\nWarmup: {stop - start:>4.4f} s, result {foo} (displayed to avoid compiler optimizing warmup away)\n" + +warmup() + echo "\n⚠️ Measurements are approximate and use the CPU nominal clock: Turbo-Boost and overclocking will skew them." echo "==========================================================================================================\n"