Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content
Benchmarks

Benchmarks

Measured on Apple M4, median of 10,000 iterations (100,000 for sub-µs ops). Take these with a grain of salt — different machines, different compilers, different results.

Signing

hlz uses Zig's stdlib secp256k1 by default. An optional custom GLV endomorphism path (-Dfast-crypto=true) with precomputed tables gives ~3.4x faster signing — see Crypto Backends.

Operationstdlib (default)-Dfast-cryptoRust SDK (alloy)
Sign order~112 µs~34.6 µs~34.0 µs
Sign cancel~112 µs~34.1 µs~34.3 µs
Sign USD send~116 µs~34.4 µs~37.8 µs
EIP-712 struct hash~291 ns~291 ns~1.2 µs
keccak256 (32B)~125 ns~125 ns~125 ns
msgpack encode~333 ns~333 ns~250 ns

Rust SDK column measured with hypersdk v0.2.5, --release profile, same machine and inputs.

Crypto Backends

The signing hot path is dominated by a single scalar multiplication k·G (computing the ECDSA nonce point). hlz offers two backends:

stdlib (default) — Uses std.crypto.ecc.Secp256k1.basePoint.mul(). Constant-time, audited as part of Zig's standard library. Safe for all use cases including servers signing on behalf of users.

Custom GLV (-Dfast-crypto=true) — Uses GLV endomorphism with precomputed affine tables and 5×52-bit field arithmetic (same representation as libsecp256k1 and RustCrypto/k256). ~3.4x faster because it halves the number of point doublings and avoids recomputing known multiples of the generator.

The custom path is designed for constant-time behavior (branchless table lookups via cMov, fixed iteration count, mask-based sign flips), but has not been verified with Valgrind/ctgrind. For local CLI tools this is fine. For servers exposed to timing attacks, use the stdlib default.

# Default: stdlib secp256k1 (safe for all use cases)
zig build -Doptimize=ReleaseSmall
 
# Opt-in: custom GLV (~3.4x faster signing)
zig build -Doptimize=ReleaseSmall -Dfast-crypto=true

Both produce identical signatures — the switch only affects which algorithm computes the nonce point.

Binary Size

ComponentSize
hlz (ReleaseSmall, stripped)891 KB
hlz-terminal (ReleaseSmall, stripped)1036 KB
SDK only (no HTTP/TLS)116 KB

Build Time

Clean build takes ~3 seconds on Apple M4. Zig's compilation model helps here.

Reproduce

git clone https://github.com/dzmbs/hlz
cd hlz
zig build bench                        # stdlib (default)
zig build bench -Dfast-crypto=true     # custom GLV