2026-05-18 17:13:07 +02:00
|
|
|
# crypto_primitives_bench
|
2026-05-15 10:51:51 +02:00
|
|
|
|
2026-05-21 16:44:40 +02:00
|
|
|
Criterion-driven microbenchmarks for the cryptographic primitives client/wallet code uses on every transaction. No live sequencer or Bedrock needed.
|
2026-05-15 10:51:51 +02:00
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
|
|
```sh
|
2026-05-21 16:44:40 +02:00
|
|
|
cargo bench -p crypto_primitives_bench --bench primitives
|
2026-05-15 10:51:51 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## What you'll see
|
|
|
|
|
|
2026-05-21 16:44:40 +02:00
|
|
|
Criterion's per-operation report (point estimate, 95% CI, outlier counts) for:
|
2026-05-15 10:51:51 +02:00
|
|
|
|
2026-05-21 16:44:40 +02:00
|
|
|
- `keychain/new_os_random`: full mnemonic → SSK → NSK/VSK + public-key derivation (HMAC-SHA512 PBKDF dominates).
|
|
|
|
|
- `keychain/new_mnemonic`: same pipeline, mnemonic exposed.
|
|
|
|
|
- `shared_secret_key/sender_dh`: secp256k1 ECDH per recipient (includes ephemeral key gen).
|
|
|
|
|
- `encryption/encrypt` / `decrypt`: ChaCha20 over an Account note.
|
2026-05-15 10:51:51 +02:00
|
|
|
|
2026-05-21 16:44:40 +02:00
|
|
|
Per-bench JSON estimates are written under `target/criterion/<group>/<bench>/`. HTML reports at `target/criterion/report/index.html`.
|
|
|
|
|
|
|
|
|
|
## Baseline comparison
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
# On main:
|
|
|
|
|
cargo bench -p crypto_primitives_bench --bench primitives -- --save-baseline main
|
|
|
|
|
# On your branch:
|
|
|
|
|
cargo bench -p crypto_primitives_bench --bench primitives -- --baseline main
|
|
|
|
|
```
|