feat: add cross-platform benchmark comparison script

run_all.sh runs all secp256k1 benchmarks and produces a formatted
comparison table. Runs C native, Kotlin/Native, JVM (always), and
Android (only if device/emulator connected via adb).

Output includes:
- ops/sec with comma-separated numbers
- libsecp256k1 vs Quartz column headers
- verifySchnorrFast and signSchnorr (cached pk) as Quartz-only rows
- Ratio table: C vs K/Native, JNI vs JVM Kotlin (apples-to-apples)
- Android column and ratios when device is connected

Run from repo root: ./quartz/benchmarks/run_all.sh

https://claude.ai/code/session_015CtM5k88rF7WFgX8o2AGNR
This commit is contained in:
Claude
2026-04-09 21:48:12 +00:00
parent e2725718c2
commit c33e3bd54f
2 changed files with 310 additions and 15 deletions
+8 -15
View File
@@ -1,18 +1,11 @@
/*
* Standalone C benchmark for libsecp256k1 — no JVM, no JNI, no ART.
* Links against the ACINQ secp256k1-kmp-jni .so to benchmark raw C performance.
* Uses the same test vectors as the Kotlin benchmarks for direct comparison.
*
* Build:
* # Extract the native .so from the ACINQ JAR:
* jar xf ~/.gradle/caches/modules-2/files-2.1/fr.acinq.secp256k1/\
* secp256k1-kmp-jni-jvm-linux/0.23.0/*/secp256k1-kmp-jni-jvm-linux-0.23.0.jar
* cp fr/acinq/secp256k1/jni/native/linux-x86_64/libsecp256k1-jni.so .
*
* # Compile and run:
* gcc -O2 -o bench secp256k1_native_bench.c -L. -lsecp256k1-jni -Wl,-rpath,.
* ./bench
*/
// Standalone C benchmark for libsecp256k1 -- no JVM, no JNI, no ART.
// Links against the ACINQ secp256k1-kmp-jni .so to benchmark raw C performance.
// Uses the same test vectors as the Kotlin benchmarks for direct comparison.
//
// Build:
// Extract the native .so from the ACINQ JAR, then:
// gcc -O2 -o bench secp256k1_native_bench.c -L. -lsecp256k1-jni -Wl,-rpath,.
// ./bench
#include <stdio.h>
#include <stdlib.h>
#include <string.h>