Skip to content

Output Compression Benchmark Results

Date: 2026-01-15 Test Game: template_lines (Lines-pay game) Simulations: 500 base game spins


Executive Summary

Achieved 27.9% file size reduction using compact output format


Detailed Results

Test Configuration

Verbose Mode: - Output mode: OutputMode.VERBOSE - Symbol format: {"name": "L5"} - Position format: {"reel": 0, "row": 2} - Format version: "2.0-verbose"

Compact Mode: - Output mode: OutputMode.COMPACT - Symbol format: "L5" (string) - Position format: [0, 2] (array) - Format version: "2.0-compact"

File Size Comparison (500 Simulations)

Metric Verbose Compact Savings
File Size 990,449 bytes (967.24 KB) 714,514 bytes (697.77 KB) 275,935 bytes (269.47 KB)
Savings Percentage - - 27.9%

Extrapolation to 10,000 Simulations

Metric Verbose Compact Saved
Estimated Size 18.89 MB 13.63 MB 5.26 MB

Analysis

Compression Sources

The 27.9% file size reduction comes from:

  1. Symbol Compression (~15-20% savings)
  2. Before: {"name": "L5"} (14+ bytes)
  3. After: "L5" (4 bytes)
  4. ~71% reduction per symbol
  5. Impact: 25 symbols per board × high frequency

  6. Position Compression (~5-10% savings)

  7. Before: {"reel": 0, "row": 2} (29 bytes)
  8. After: [0, 2] (5 bytes)
  9. ~83% reduction per position
  10. Impact: Win positions, scatter positions, tumble positions

  11. Event Structure (minimal savings in this test)

  12. Format versioning adds minimal overhead (~20 bytes per book)
  13. Event filtering not yet implemented (Phase 3.2)

Performance Observations

  • Generation Speed: Compact mode ran in 0.516s vs Verbose 0.598s
  • Speed Improvement: ~13% faster (likely due to less string manipulation)
  • Memory Usage: Not measured in this test
  • RTP Accuracy: Identical (28.146) - no correctness regression

Comparison to Initial Estimates

Metric Initial Estimate Actual Result Delta
Board Compression 61% ~71% per symbol ✅ Better
Total File Reduction 40-60% 27.9% ⚠️ Lower

Why Lower Than Expected?

The initial 61% estimate was for board data only. The actual 27.9% is for complete books including: - Events metadata (type, amounts, etc.) - Win calculations - Game state transitions - Book metadata (id, criteria, payout_multiplier)

These non-compressible elements dilute the overall savings.

Additional Optimization Potential

Phase 3.2 (Event Optimization) could add: - Event filtering: Skip implicit/redundant events (~10-15% additional savings) - Losing board skipping: Skip reveal events for 0-win spins (~5-10% additional savings)

Estimated Phase 3.2 impact: +15-25% additional savings Projected total savings: 40-50% (matches initial estimate)


Backward Compatibility

Fully backward compatible

  • Defaults to verbose mode
  • Format version field optional
  • Old books (no version) work correctly
  • Analysis tools support both formats
  • RGS verification detects and handles both formats

Production Recommendations

Immediate Adoption (Phase 3.1)

Benefits: - 27.9% file size reduction - 13% faster generation - No breaking changes - Tested with 31/31 tests passing

Risk: Low - backward compatible, well-tested

Recommendation: ✅ Ready for production use

Future Enhancements (Phase 3.2)

Additional optimizations: - Event filtering for implicit events - Losing board skipping - Verbose event level configuration

Projected total savings: 40-50%


Benchmark Details

Command: python3 benchmark_compression.py 500

Environment: - Python 3.13.3 - Game: template_lines (Lines-pay with free spins) - Threads: 1 - Batch size: 500 - Compression: Disabled (measuring raw JSON)

Test Date: 2026-01-15


Conclusion

Phase 3.1 successfully delivers 27.9% file size reduction

The compact output format provides significant storage savings with: - No correctness regressions (RTP unchanged) - Improved generation speed (+13%) - Full backward compatibility - Clean architecture (OutputFormatter class)

With Phase 3.2 optimizations, we expect to reach 40-50% total reduction.

Status: Production ready ✅