Files
pokemon-battle-engine/benchmarks
2025-08-13 23:27:08 +00:00
..
2025-08-13 23:27:08 +00:00

Benchmarks Directory (benchmarks/)

This directory contains performance benchmarks and profiling tools for the Pokemon battle simulator.

Planned Structure

benchmarks/
├── core/                  # Core system benchmarks
│   ├── battle_speed.cpp   # Battle simulation speed
│   ├── pokemon_creation.cpp # Pokemon instantiation
│   ├── move_calculation.cpp # Move damage calculations
│   └── type_lookup.cpp    # Type effectiveness lookups
├── data/                  # Data loading benchmarks
│   ├── json_parsing.cpp   # JSON data parsing speed
│   └── data_caching.cpp   # Cache performance
├── ai/                    # AI performance benchmarks
│   ├── ai_decision_time.cpp # AI move selection speed
│   └── minimax_depth.cpp    # Minimax algorithm scaling
├── memory/                # Memory usage benchmarks
│   ├── memory_usage.cpp   # Memory footprint analysis
│   └── allocation_speed.cpp # Dynamic allocation performance
├── scenarios/             # Real-world scenario benchmarks
│   ├── tournament.cpp     # Tournament simulation
│   └── monte_carlo.cpp    # Monte Carlo battle analysis
├── results/               # Benchmark results and reports
│   ├── baseline/          # Baseline performance data
│   └── reports/           # Generated performance reports
└── CMakeLists.txt         # Benchmark build configuration

Benchmarking Framework

  • Google Benchmark: Primary benchmarking library
  • Automated Regression Detection: Performance alerts on slowdowns
  • Multiple Metrics: Time, memory, CPU usage, cache misses
  • Statistical Analysis: Multiple runs with confidence intervals

Key Performance Targets

Battle Simulation

  • Target: 1M+ battles per second on modern hardware
  • Memory: < 1KB per Pokemon instance
  • Latency: < 1µs per move calculation

Data Loading

  • Target: < 100ms to load all Gen 1 data
  • Memory: Efficient data structures with minimal overhead
  • Caching: Fast lookup tables for frequently accessed data

AI Performance

  • Random AI: < 1µs per decision
  • Minimax AI: Configurable depth with time limits
  • Memory: Bounded memory usage for tree search

Profiling Integration

  • CPU Profiling: Integration with perf, VTune
  • Memory Profiling: Valgrind, AddressSanitizer integration
  • Cache Analysis: Cache miss analysis and optimization
  • Flame Graphs: Visual performance analysis

Continuous Performance Monitoring

Benchmarks run automatically to detect performance regressions and track improvements over time.