Benchmark different lookup argument implementations with configurable debug logging and parallel execution.
- Benchmarking
- Parallel Execution
- Debug Logging System
- Basic Usage Examples
- Advanced Usage Examples
- New Features
- Parameter Reference
Usage: cargo bench --bench proof_system -- [OPTIONS]
Options:
--system <s> Lookup system(s) to run. [possible values: all, cq, baloo, logupgkr, plookup, caulk, lasso]
--k <K> (Range of) log size of the lookup table.
--ratio, --n-to-n-ratio <RATIO> Ratio between table size (N) and lookup size (n). Default is 2. Supports comma-separated multiple values.
--verbose, -v Enable verbose output.
--debug, -d Enable debug mode with detailed output.
--format, -f <FORMAT> Output format. [possible values: table, compact, csv, json]🚀 NEW: Automatic Parallel Benchmark Execution + Individual Algorithm Parallelization
The benchmark system now supports two levels of parallelization:
Multiple benchmark tasks run in parallel using Rust's rayon crate, providing significant performance improvements:
- Automatic parallelization: All benchmark combinations (systems × k-values × ratios) run in parallel
- Thread-safe execution: Safe concurrent access to shared resources and file outputs
- Progress tracking: Real-time progress updates with thread IDs for debugging
- Consistent results: Results are automatically sorted for consistent display order
- Load balancing: Work is automatically distributed across available CPU cores
- Faster execution: Benchmark suites complete significantly faster than serial execution
- CPU utilization: Better utilization of multi-core systems
- Time savings: Particularly beneficial for comprehensive benchmarks with multiple systems and parameter combinations
Individual proof systems can now run in parallel or non-parallel mode based on the parallel feature flag:
- LogupGKR: ✅ Full parallel/non-parallel support
- Lasso: ✅ Full parallel/non-parallel support (NEW!)
- HyperPlonk: ✅ Always parallel (uses
util::parallelmodule) - Plookup: ❌ Always serial
- CQ: ❌ Always serial
- Baloo: ❌ Always serial
- Caulk: ❌ Always serial
You can now compare the performance difference between parallel and non-parallel implementations:
# Run with parallel algorithms enabled (default)
cargo bench --bench proof_system -- --system lasso --k 8..12 --format table
# Run with parallel algorithms disabled
cargo bench --bench proof_system --no-default-features --features timer -- --system lasso --k 8..12 --format table→ Running 24 benchmark tasks in parallel...
→ Systems: ["CQ", "Baloo", "LogupGKR", "Plookup", "Caulk", "Lasso"]
→ K values: [8, 9]
→ N:n ratios: [2, 4]
→ [Thread ThreadId(6)] Running CQ benchmark with k = 8, N:n ratio = 2
→ [Thread ThreadId(5)] Running Plookup benchmark with k = 8, N:n ratio = 2
→ [Thread ThreadId(9)] Running Baloo benchmark with k = 8, N:n ratio = 2
...
✓ [Thread ThreadId(7)] Completed LogupGKR benchmark with k = 8, N:n ratio = 2
✓ [Thread ThreadId(2)] Completed Lasso benchmark with k = 8, N:n ratio = 2
→ All 24 benchmark tasks completed!- Uses
rayon::par_iter()for parallel task execution - Thread-safe result collection with
Arc<Mutex<Vec<BenchmarkResult>>> - Maintains file output integrity across concurrent writes
- Preserves all original functionality while adding parallelization
This project now supports controllable debug message output. You can control the displayed message level through environment variables.
The system supports three log levels:
- Silent (
silentor0) - No debug messages - Info (
infoor1) - Only important information (default level) - Debug (
debugor2) - Detailed debug information
# Set to debug mode (show all messages)
export LOOKUP_LOG_LEVEL=debug
# Set to info mode (only important messages, default)
export LOOKUP_LOG_LEVEL=info
# Set to silent mode (no debug messages)
export LOOKUP_LOG_LEVEL=silent# Run lasso test in debug mode
LOOKUP_LOG_LEVEL=debug cargo test test_lasso
# Run tests in silent mode (no debug output)
LOOKUP_LOG_LEVEL=silent cargo test
# Run with default info mode
cargo test
# Run benchmarks without debug messages
LOOKUP_LOG_LEVEL=silent cargo bench
# Run benchmarks with detailed debug information
LOOKUP_LOG_LEVEL=debug cargo benchIf you're extending the code, you can use the following macros:
use plonkish_backend::{log_info, log_debug};
// Initialize logging (usually called once at program start)
plonkish_backend::logging::init_logging();
// Info level messages (important information)
log_info!("Processing {} elements", count);
// Debug level messages (detailed debugging information)
log_debug!("Internal state: {:?}", state);
// Conditional debug println (compatible with existing code)
debug_println!("DEBUG: Value = {}", value);Before (all debug messages shown):
DEBUG Prover memory index 0: id_value = 0x0000...
DEBUG Prover memory index 0: init = 0x22fc...
DEBUG Prover memory index 1: id_value = 0x0001...
DEBUG MemoryCheckingProver::prove: num_memories = 2
...massive debug output...
After (controllable):
Info mode (default):
[INFO] Processing Lasso proof with k=8
[INFO] Verification completed successfully
Debug mode:
[INFO] Processing Lasso proof with k=8
[DEBUG] Prover memory index 0: id_value = 0x0000...
[DEBUG] Prover memory index 0: init = 0x22fc...
[DEBUG] MemoryCheckingProver::prove: num_memories = 2
...detailed debug output...
[INFO] Verification completed successfully
Silent mode:
(only test results, no debug messages)
- Clean default output: Only shows important messages by default, not overwhelmed by debug messages
- Flexible debugging: Easy to enable detailed output when debugging is needed
- Performance friendly: Debug formatting and output are skipped in silent/info modes
- Backward compatible: Existing code continues to work normally
- Environment variable control: Change log level without recompilation
cargo bench --bench proof_system -- \
--system all \
--k 8 \
--format tablecargo bench --bench proof_system -- \
--system logupgkr \
--k 8..12 \
--format compactcargo bench --bench proof_system -- \
--system all \
--k 10 \
--ratio 8 \
--format table# Test single ratio
cargo bench --bench proof_system -- \
--system all \
--k 8..12 \
--ratio 4 \
--format compact
# Test multiple ratios (comma-separated)
cargo bench --bench proof_system -- \
--system all \
--k 8..12 \
--ratio 2,4,8,16 \
--format compact# Table format with detailed information including proof size
cargo bench --bench proof_system -- \
--system all \
--k 8..12 \
--ratio 2,4,8 \
--format table
# Compact format also displays proof size
cargo bench --bench proof_system -- \
--system all \
--k 8..12 \
--ratio 2,4,8 \
--format compact# Full benchmark test (runs in parallel automatically)
cargo bench --bench proof_system -- \
--system logupgkr,plookup,lasso \
--k 8..15 \
--ratio 1,2,4,8,16,32 \
--format table \
--verbose
# Specific system deep analysis (parallel execution)
cargo bench --bench proof_system -- \
--system lasso \
--k 10..14 \
--ratio 2,4,8,16 \
--format csv \
--debug# Small parallel test (6 tasks: 6 systems × 1 k-value × 1 ratio)
cargo bench --bench proof_system -- \
--system all \
--k 8 \
--ratio 2 \
--verbose
# Medium parallel test (24 tasks: 6 systems × 2 k-values × 2 ratios)
cargo bench --bench proof_system -- \
--system all \
--k 8..10 \
--ratio 2,4 \
--verbose
# Large parallel test (120 tasks: 5 systems × 4 k-values × 6 ratios)
cargo bench --bench proof_system -- \
--system cq,baloo,logupgkr,plookup,lasso \
--k 8..12 \
--ratio 1,2,4,8,16,32 \
--format compact- Automatic parallelization: All benchmark tasks run concurrently using
rayon - Significant speedup: Better utilization of multi-core systems
- Thread-safe operation: Safe concurrent file writing and result collection
- Real-time progress: Thread-level progress tracking with IDs
- Consistent output: Results automatically sorted for predictable display order
- Three log levels: Silent, Info (default), Debug
- Environment variable control:
LOOKUP_LOG_LEVEL=debug/info/silent - Performance optimized: Debug formatting skipped when disabled
- Thread-safe: Global configuration with safe concurrent access
- Before: Only single N:n ratio testing
- Now: Support comma-separated multiple ratios like
--ratio 2,4,8 - Purpose: Comprehensive analysis of how different table-to-lookup size ratios affect performance across systems
- New Field:
proof_size(in bytes) - Display Format:
- Less than 1KB: "XXXnB"
- Greater than 1KB: "X.XKB"
- No data available: "N/A"
- Purpose: Compare proof size efficiency across different proving systems
- Table Format: Added "Proof Size" column
- Compact Format: Includes proof size information
- Compatibility: All existing formats (CSV, JSON) support the new field
By default, the benchmark uses K to define table_size = 2^K (N) and lookup_size = table_size / ratio (n). The default ratio is 2, giving N:n = 2:1.
This default 2:1 ratio might not fully represent scenarios where sublinear-N protocols like Baloo and CQ are expected to perform best. These protocols shine most when N is much larger than n (e.g., N = 8n or more).
Using the --ratio parameter, you can:
- Single ratio:
--ratio 8for N = 8n - Multiple ratios:
--ratio 2,4,8,16to test various scenarios simultaneously
This allows better showcasing of performance characteristics under different workload ratios.
--system: Choose systems to benchmark (all, cq, baloo, logupgkr, plookup, caulk, lasso)--k: Set k value range, e.g.,8..12or single value10--ratioor--n-to-n-ratio: Set N:n ratio(s), supports single value or comma-separated multiple values--format: Output format (table, compact, csv, json)--verboseor-v: Display detailed output--debugor-d: Display debug information
LOOKUP_LOG_LEVEL=debugorLOOKUP_LOG_LEVEL=2: Show all debug and info messagesLOOKUP_LOG_LEVEL=infoorLOOKUP_LOG_LEVEL=1: Show only info messages (default)LOOKUP_LOG_LEVEL=silentorLOOKUP_LOG_LEVEL=0: No debug output
Results will be formatted according to the specified output format and displayed in the terminal, now including timing information and proof sizes for comprehensive analysis.
This work is forked from Plonkish by Han