Skip to content

Instantly share code, notes, and snippets.

@theStack
Last active November 7, 2025 17:49
Show Gist options
  • Select an option

  • Save theStack/adb2924767ea10dc5150ab40b02f0301 to your computer and use it in GitHub Desktop.

Select an option

Save theStack/adb2924767ea10dc5150ab40b02f0301 to your computer and use it in GitHub Desktop.
Benchmarking secp256k1 PR #1767
#!/usr/bin/env bash
set -e
git checkout master
git fetch upstream pull/1767/head:pr1767
git checkout pr1767
build_bench_at_commit() {
local commit=$1
local suffix=$2
local benchbin=pr1767_bench_${suffix}
if [ -f $benchbin ]; then
echo "Benchmark binary ${benchbin} already exists, skip build."
return 0
fi
echo "Building secp #1767 '${suffix}' (commit ${commit})..."
git checkout -q $commit
# let's do a fresh build every time, just to be sure
rm -rf build
cmake -B build > $suffix.log 2>1
cmake --build build --parallel 4 >> $suffix.log 2>1
cp ./build/bin/bench_ecmult $benchbin
}
run_bench() {
local suffix=$1
local benchbin=pr1767_bench_${suffix}
echo "Running benchmark binary ${benchbin}..."
SECP256K1_BENCH_ITERS=100000 ./${benchbin} pippenger_wnaf > pr1767_bench_${suffix}_result.txt
}
build_bench_at_commit d0f3123c0c2d4643a0191af6e7c5e18032666605 baseline
build_bench_at_commit 2ccc5e02776b8ae3483adf342b741abd99e48931 variant1
build_bench_at_commit 867fe34dd4f642fb966d5ee652e0d77a9adafa41 variant2
build_bench_at_commit 0fc73f397bc6a10b723b89d6f2a0dc52e7621748 variant3
run_bench baseline
run_bench variant1
run_bench variant2
run_bench variant3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment