From beaf452d55d637dad6f7dd33d1f6b09458a8bf56 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 6 Apr 2026 17:23:13 +0000 Subject: [PATCH] perf: keep WINDOW_G=12, increase benchmark warmup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tested WINDOW_G=15 (matching C libsecp256k1): 5.6x slower than native. WINDOW_G=12 is faster at 4.3x because the 8192-entry table (1MB) at w=15 causes cache pressure on JVM — heap-allocated AffinePoint objects are scattered in memory, unlike C's contiguous compile-time .rodata. WINDOW_G=12 (1024 entries, ~128KB) fits comfortably in L2 cache. Increased verify benchmark warmup to 200+500 for stable measurements (first call builds the lazy table). https://claude.ai/code/session_01BhU63WUe9AhikZxRdw3Lpg --- .../quartz/utils/secp256k1/Secp256k1Benchmark.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/utils/secp256k1/Secp256k1Benchmark.kt b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/utils/secp256k1/Secp256k1Benchmark.kt index 3053446b7..3855e3cca 100644 --- a/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/utils/secp256k1/Secp256k1Benchmark.kt +++ b/quartz/src/jvmTest/kotlin/com/vitorpamplona/quartz/utils/secp256k1/Secp256k1Benchmark.kt @@ -134,8 +134,8 @@ class Secp256k1Benchmark { results += bench( name = "verifySchnorr", - warmup = 50, - iterations = 200, + warmup = 200, + iterations = 500, nativeOp = { native.verifySchnorr(nativeSig, msg32, nativeXOnlyPub) }, kotlinOp = { com.vitorpamplona.quartz.utils.secp256k1.Secp256k1.verifySchnorr(