Benchmark Baseline - 2025-11-15
Pre-Optimization Results
This baseline was established before implementing the optimization improvements outlined in the 2025-11-15 optimization plan. All benchmarks were run using Criterion with the pre-optimization baseline saved.
Parse Benchmarks
Low-level parsing operations:
- Format Detection: 5.99 ns (5.89 - 6.08 ns range)
- JPEG Segment Parsing: 52.99 ns (52.31 - 53.62 ns range)
- TIFF IFD Parsing: 167.84 ns (164.38 - 170.90 ns range)
- Full Read Metadata: 7.49 ms (7.26 - 7.72 ms range)
Integration Benchmarks
End-to-end performance across file formats:
Single File Extraction
- JPEG Simple: 12.58 ms (12.09 - 13.21 ms range)
- JPEG Complex: 6.52 ms (6.41 - 6.64 ms range)
- PNG Simple: 16.58 ms (15.05 - 18.20 ms range)
- PNG Complex: 6.36 ms (6.29 - 6.43 ms range)
- TIFF Simple: 6.94 ms (6.82 - 7.07 ms range)
Batch Processing
- Batch 16 JPEGs: 147.23 ms (138.91 - 156.21 ms range)
- Average per file: ~9.20 ms
Note: The batch benchmark used 16 JPEG files (not 100) as that was the number available in the test fixtures directory.
Large File Handling
- TIFF Multipage: 7.78 ms (7.63 - 7.94 ms range)
- JPEG Large Dimension: 6.96 ms (6.81 - 7.13 ms range)
Format Comparison
- JPEG: 5.89 ms (5.77 - 6.01 ms range)
- PNG: 21.59 ms (19.27 - 23.95 ms range)
- TIFF: 27.18 ms (26.37 - 28.08 ms range)
- PDF: 25.46 ms (24.68 - 26.29 ms range)
- MP4: 25.28 ms (24.74 - 25.83 ms range)
GPS Coordinate Extraction
- GPS Coordinate Extraction (3 files): 77.61 ms (73.27 - 82.29 ms range)
- Average per file: ~25.87 ms
Binary Size
- Release build: 3.6 MB (with LTO enabled, stripped)
Flamegraph Analysis
A flamegraph was successfully generated for baseline profiling analysis. The flamegraph is saved as flamegraph-baseline.svg in the project root directory.
Key observations:
- Flamegraph generated using
cargo flamegraphon macOS - Profiled against JPEG test fixture:
tests/fixtures/jpeg/simple/sample_with_exif.jpg - Generated without requiring sudo privileges (macOS Instruments used as backend)
- 47 KB SVG file containing detailed call stack visualization
Note: For detailed hotspot analysis, open flamegraph-baseline.svg in a web browser. The interactive visualization shows function call hierarchy with time percentages.
Performance Characteristics
Strengths
- Very fast format detection: Sub-6ns indicates excellent optimization
- Good JPEG performance: JPEG files process faster than other formats
- Consistent small-file performance: Most operations in the 6-7ms range
Areas for Improvement
- PNG processing: ~21ms average is significantly slower than JPEG (~6ms)
- TIFF processing: ~27ms average shows room for optimization
- Batch processing: At 9.20ms per file, we're not meeting the 5ms target for bulk operations
- GPS extraction: At 25.87ms per file, GPS coordinate extraction is slower than expected
Target Improvements
Based on the optimization plan:
Conservative goal: 10-20% faster runtime
- Parse benchmarks: Target 5-6ms for full read metadata (currently 7.49ms)
- Integration: Target 5-7ms for JPEG, 15-18ms for PNG
Optimistic goal: 20-35% with allocation optimizations
- Parse benchmarks: Target 4-5ms for full read metadata
- Integration: Target 4-5ms for JPEG, 12-15ms for PNG
Binary size: 3-10% reduction
- Current: 3.6 MB
- Target: 3.2-3.5 MB
Methodology
Benchmark Execution
# Parse benchmarks
cargo bench --bench parse_benchmarks -- --save-baseline pre-optimization
# Integration benchmarks
cargo bench --bench integration_benchmarks -- --save-baseline pre-optimizationFlamegraph Generation
# Build release binary
cargo build --release
# Generate flamegraph (macOS - no sudo required)
cargo flamegraph --bin oxidex -- tests/fixtures/jpeg/simple/sample_with_exif.jpgEnvironment
- Platform: macOS (Darwin 25.1.0)
- Rust toolchain: As configured in project
- Optimization level: 3 (release profile)
- LTO: Enabled (thin for benchmarks, full for release)
- Code generation units: 1
- Strip symbols: Yes (release)
Next Steps
- Implement Task 5: Zero-allocation format detection optimization
- Implement Task 6: SIMD-based byte scanning for segment parsing
- Compare against this baseline using:
cargo bench -- --baseline pre-optimization - Document improvements and verify targets are met