Skip to main content

Crate memory_profile

Crate memory_profile 

Source
Expand description

End-to-end prover memory profile.

Proves either the canonical benchmark circuit (kimchi::bench::BenchmarkCtx) or a serialised mina circuit fixture (the same kimchi_inputs_*.ser files the proof_criterion_mina bench consumes) under a counting global allocator and reports, for the proof-creation window: total bytes allocated, allocation count, peak live bytes (and its delta over the bytes live when the window opened), plus jemalloc’s peak resident set sampled by a background thread. The process exists for this one measurement, so the counters are exact for a deterministic workload β€” a single run is the answer.

Usage:

cargo run --release -p kimchi --bin memory_profile --features diagnostics -- synthetic [--srs-log2 16]
cargo run --release -p kimchi --bin memory_profile --features diagnostics -- fixture <kimchi_inputs_CURVE_SEED.ser>

synthetic proves the benchmark circuit at the given domain/SRS size; fixture proves a mina fixture, whose curve and seed are parsed from the filename exactly as in proof_criterion_mina. Output is a single JSON object on stdout (byte counts, not MB), meant to be collected across fixtures and diffed against a baseline run β€” see scripts/memory-profile-mina-circuits.sh and scripts/memory-profile-diff.py. One fixture per invocation: jemalloc retains pages across proofs, so peak_resident is only trustworthy for the first proof in a process. The resident-set sampler interval is KIMCHI_MEMORY_PROFILE_SAMPLE_MS (default 25).

ModulesΒ§

counting_alloc πŸ”’
mem_profile πŸ”’
An allocation profile over a window of execution.

StructsΒ§

Fixture πŸ”’
A serialised mina circuit fixture, addressed by the filename convention kimchi_inputs_CURVE_SEED.ser that proof_criterion_mina also uses.
Report πŸ”’
One profiled proof, as the JSON object written to stdout.

EnumsΒ§

Cli πŸ”’

FunctionsΒ§

main πŸ”’
profile_fixture_curve πŸ”’
profile_mina_fixture πŸ”’
profile_synthetic πŸ”’