Skip to content

Instantly share code, notes, and snippets.

View kyhorne's full-sized avatar

Kyle Horne kyhorne

View GitHub Profile
@kyhorne
kyhorne / README.md
Created April 23, 2026 20:27
Autotune benchmark artifacts — StripePaymentsExtensions::Crypto::ChainContext

Autotune benchmark artifacts — StripePaymentsExtensions::Crypto::ChainContext

These files drove the autotune session that produced the perf(crypto): eliminate per-call allocations in ChainContext.build PR against shop/world. They are extracted from the finalized branch so the PR diff is focused on the production code change.

Files

  • bench_crypto_chain_context.rb — standalone Ruby benchmark. Inlines Sorbet (T) and Secrets shims, then loads the real address.rb, rewards_campaign.rb, and chain_context.rb from the monolith. Workload: 300,000 outer iterations × 3 ChainContext.build shapes (mainnet/no-bps, mainnet/300-bps, testnet) = 900,000 build calls. Emits METRIC total_µs=..., METRIC allocations=..., and METRIC per_call_ns=... to stdout. No Rails boot.
  • bench_crypto_chain_context_check.rb — correctness harness. Replays every assertion from ChainContextTest (10 assertions across 7 test cases) against the live sourc