Performance
Performance characteristics and benchmarks
Performance
This document covers Paraloom's performance characteristics and optimization strategies.
Key Metrics
Privacy Layer
| Operation | Time | Notes |
|---|---|---|
| Proof Generation | 2-3s | User-side, parallelizable |
| Proof Verification | ~10ms | Validator-side |
| Poseidon Hash | Under 1ms | Per hash operation |
Consensus
| Metric | Value |
|---|---|
| Consensus Latency | Under 1s |
| Verification Broadcast | Under 100ms |
| Vote Collection | Under 500ms |
Compute Layer
| Job Type | Typical Time |
|---|---|
| Simple WASM | Under 1s |
| ZK Proof Generation | 2-5s |
| ML Inference | 5-30s |
Network
| Metric | Value |
|---|---|
| P2P Message Latency | Under 100ms (local) |
| Bridge Polling | 10s intervals |
| Heartbeat | 30s intervals |
Benchmarks
Proof Generation
Benchmark: generate_withdrawal_proof
Iterations: 100
Mean: 2.34s
Std Dev: 0.21s
Min: 1.98s
Max: 3.12s
Hardware: AMD Ryzen 9 5900X, 32GB RAMProof Verification
Benchmark: verify_groth16_proof
Iterations: 10000
Mean: 9.8ms
Std Dev: 0.4ms
Min: 8.9ms
Max: 12.1ms
Hardware: AMD Ryzen 9 5900X, 32GB RAMPoseidon Hash
Benchmark: poseidon_hash_pair
Iterations: 1000000
Mean: 0.12ms
Throughput: ~8300 hashes/sec
Hardware: AMD Ryzen 9 5900X, 32GB RAMWASM Execution
Benchmark: wasm_simple_compute
Iterations: 1000
Mean: 0.8ms
Memory: 1.2MB peak
Benchmark: wasm_complex_compute (1MB input)
Iterations: 100
Mean: 45ms
Memory: 12MB peak
Hardware: AMD Ryzen 9 5900X, 32GB RAMThroughput
Current Limits
| Operation | Throughput |
|---|---|
| Deposits | ~100/sec (Solana limited) |
| Withdrawals | ~1/sec (consensus limited) |
| Compute Jobs | ~10/sec (per validator) |
| P2P Messages | ~1000/sec |
Bottlenecks
-
Consensus Round Time
- 7/10 validators must respond
- Network latency adds up
-
Proof Generation
- CPU-intensive
- Single-threaded by default
-
Solana Block Time
- ~400ms per slot
- Transaction confirmation
Optimization Strategies
Proof Generation
Parallel Proving:
use rayon::prelude::*;
// Generate multiple proofs in parallel
let proofs: Vec<Proof> = inputs
.par_iter()
.map(|input| generate_proof(input))
.collect();Key Caching:
lazy_static! {
static ref PROVING_KEY: ProvingKey = load_proving_key();
static ref VERIFYING_KEY: VerifyingKey = load_verifying_key();
}Consensus
Parallel Verification:
// Validators verify in parallel
let results: Vec<bool> = proofs
.par_iter()
.map(|proof| verify_proof(proof))
.collect();Batch Processing:
// Batch multiple verifications
let batch_result = verify_batch(&proofs, &public_inputs);Compute Layer
Memory Optimization:
// Use streaming for large inputs
let result = engine.execute_streaming(
wasm_code,
input_stream,
64 * 1024 * 1024, // 64MB limit
)?;Job Prioritization:
// Prioritize smaller jobs
job_queue.sort_by_key(|job| job.estimated_time);Network
Connection Pooling:
// Reuse connections
let pool = ConnectionPool::new(max_connections: 50);
let conn = pool.get_connection(peer_id)?;Message Batching:
// Batch small messages
let batch = messages
.chunks(100)
.map(|chunk| create_batch(chunk))
.collect();Resource Usage
Memory
| Component | Typical Usage |
|---|---|
| Validator Node | 500MB - 1GB |
| Proof Generation | 100-200MB |
| WASM Execution | 64MB limit |
| Network Stack | 50-100MB |
CPU
| Operation | CPU Usage |
|---|---|
| Proof Generation | 100% (single core) |
| Proof Verification | 10-20% |
| WASM Execution | 50-100% |
| Idle | 1-5% |
Disk
| Data | Size |
|---|---|
| Merkle Tree | ~100 bytes/commitment |
| Nullifier Set | ~40 bytes/nullifier |
| Proving Key | ~1.5 MB |
| Verifying Key | ~600 bytes |
Network
| Traffic | Bandwidth |
|---|---|
| Idle | Under 1 KB/s |
| Active Verification | ~10 KB/s |
| Compute Job | ~100 KB/s |
| Peak | ~1 MB/s |
Scaling Considerations
Horizontal Scaling
- Add more validators for consensus throughput
- Distribute compute jobs across validators
- Use CDN for static assets (proofs, keys)
Vertical Scaling
- Faster CPU for proof generation
- More RAM for larger WASM jobs
- NVMe SSD for storage operations
Future Optimizations
-
Batch Proof Verification
- Aggregate multiple proofs
- Single verification for batch
-
Recursive Proofs
- Prove verification of proofs
- Constant-size proofs
-
Hardware Acceleration
- GPU proof generation
- FPGA verification
-
Layer 2 Aggregation
- Bundle transactions
- Single proof for bundle
Monitoring Performance
Metrics to Track
// Key metrics
paraloom_proof_generation_seconds
paraloom_proof_verification_seconds
paraloom_consensus_rounds_total
paraloom_consensus_latency_seconds
paraloom_compute_jobs_total
paraloom_compute_duration_seconds
paraloom_network_messages_total
paraloom_network_latency_secondsAlerting Thresholds
| Metric | Warning | Critical |
|---|---|---|
| Proof Generation | >5s | >10s |
| Consensus Latency | >2s | >5s |
| Job Queue Length | >100 | >500 |
| Memory Usage | >80% | >95% |