BENCHMARK_RESULTS.md raw

Performance Benchmark Results

Test Environment

Implementations Compared

  1. BTCEC - btcsuite/btcd/btcec/v2 (Pure Go)
  2. P256K1 - p256k1.mleku.dev v1.0.2 (Pure Go)
  3. P8K - p8k.mleku.dev (Purego + libsecp256k1 v5.0.0)

Results Summary

OperationBTCEC (ns/op)P256K1 (ns/op)P8K (ns/op)P8K Speedup vs BTCECP8K Speedup vs P256K1
Pubkey Derivation32,22628,09819,3291.67x faster1.45x faster
Schnorr Sign225,53628,85519,98211.3x faster 🚀1.44x faster
Schnorr Verify153,205133,23536,5414.19x faster3.65x faster
ECDH125,67997,43541,0873.06x faster 💨2.37x faster

Memory Allocations

OperationBTCECP256K1P8K
Pubkey Derivation80 B / 1 alloc0 B / 0 alloc160 B / 4 allocs
Schnorr Sign1408 B / 26 allocs640 B / 12 allocs304 B / 5 allocs
Schnorr Verify240 B / 5 allocs96 B / 3 allocs216 B / 5 allocs
ECDH32 B / 1 alloc0 B / 0 alloc208 B / 6 allocs

Key Findings

🏆 P8K Wins All Categories

P8K consistently outperforms both pure Go implementations:

Memory Efficiency

Trade-offs

P8K (This Package)

P256K1

BTCEC

Recommendations

Choose P8K if:

Choose P256K1 if:

Choose BTCEC if:

Conclusion

P8K delivers exceptional performance by leveraging the highly optimized C implementation of libsecp256k1 through CGO-free dynamic loading. The 11x speedup for Schnorr signing makes it ideal for applications requiring high-throughput cryptographic operations.

The bundled library for Linux AMD64 provides zero-installation convenience while maintaining the performance benefits of the native C library.