This document explains how to run and interpret the benchmark suite.
# Run all benchmarks (fast mode, ~5-8 minutes)
cargo bench
# Run extended benchmarks (~30 minutes)
CIPHERSCOPE_BENCH_EXTENDED=1 cargo bench
# Run a specific benchmark
cargo bench --bench component_bench
cargo bench --bench scale_benchRuns essential benchmarks with minimal variants. Completes in ~5-8 minutes.
Set CIPHERSCOPE_BENCH_EXTENDED=1 to enable:
- More file size variants (1KB-1MB)
- More file count variants (100-10K)
- More thread counts (1,2,4,8,16,32)
- Memory profiling benchmarks
- Large fixture benchmarks (5K+ files)
| Benchmark | Normal Mode | Extended Mode |
|---|---|---|
scan_bench |
4 variants (~1 min) | Same |
component_bench |
8 variants (~1.5 min) | 15 variants (~3 min) |
file_size_bench |
3 sizes (~1 min) | 5 sizes (~2 min) |
scale_bench |
3 file counts (~1.5 min) | 6 counts + density (~5 min) |
thread_scaling_bench |
3 thread counts (~1 min) | 7 thread counts (~3 min) |
memory_bench |
Skipped | 3 variants (~3 min) |
large_fixture_bench |
Skipped | 5K files + nested (~5 min) |
Basic end-to-end scan benchmark using the existing fixtures.
cargo bench --bench scan_benchIsolates individual scanner components:
parsing- Tree-sitter AST parsinganchor_hint- Fast regex pre-filterlibrary_anchors- Library detectionalgorithm_detection- Pattern matchingfull_pipeline- Complete scan pipelinelanguage_detection- File extension mappingpattern_loading- PatternSet initialization
cargo bench --bench component_benchTests performance with different file sizes (1KB, 10KB, 100KB, etc.).
cargo bench --bench file_size_benchTests performance with different file counts (100, 500, 1000, etc.).
cargo bench --bench scale_benchMeasures parallel scaling efficiency.
cargo bench --bench thread_scaling_benchProfiles memory usage during scans.
CIPHERSCOPE_BENCH_EXTENDED=1 cargo bench --bench memory_benchTests with large synthetic fixtures (5K+ files).
CIPHERSCOPE_BENCH_EXTENDED=1 cargo bench --bench large_fixture_benchCriterion reports time as a range:
parsing/lang/python time: [1.98 ms 2.00 ms 2.01 ms]
thrpt: [4.76 MiB/s 4.79 MiB/s 4.83 MiB/s]
- First line: timing (low / median / high)
- Second line: throughput (if configured)
Elements/s: Files scanned per secondMiB/s: Data processed per second
| Variable | Description |
|---|---|
CIPHERSCOPE_BENCH_EXTENDED |
Enable extended benchmarks |
CIPHERSCOPE_BENCH_FIXTURE |
Custom fixture path for scan_large_bench |
CIPHERSCOPE_BENCH_THREADS |
Custom thread counts (comma-separated) |
- Close other applications to reduce noise
- Run multiple times to verify consistency
- Results are saved to
target/criterion/ - HTML reports:
target/criterion/<name>/report/index.html
# Save baseline
cargo bench -- --save-baseline before
# Make changes, then compare
cargo bench -- --baseline before