undef-engine 2026-03-19
Rate limiter 186x speedup, memray profiling, and broadcast optimization
469 files · 506,105+ · 7,507-

Rate limiter and broadcast performance optimizations

3 files changed
  • .gitignore Added performance artifact ignores
  • Makefile Added performance targets
  • CLI_REFERENCE.md Updated CLI reference with perf commands
  • Fixed rate limiter O(n) list allocation achieving 186x faster execution and 80% less memory usage streamline behavioral
  • Eliminated double session serialization in the game action path streamline internal
  • Serialized broadcast messages once instead of per-player to reduce redundant model_dump_json calls streamline internal
  • Added session read cache and tightened rate_check threshold streamline internal

Memray memory profiling infrastructure

10 files changed
  • memray_action_cycle_stress.py Action cycle memory stress test
  • memray_analysis.py Memray analysis utilities
  • memray_broadcast_stress.py Broadcast memory stress test
  • memray_game_state_stress.py Game state memory stress test
  • memray_locking_stress.py Locking memory stress test
  • memray_pubsub_stress.py PubSub memory stress test
  • memray_rate_limiting_stress.py Rate limiting memory stress test
  • memray_serialization_stress.py Serialization memory stress test
  • run_memray_stress.py Memray stress test runner
  • run_performance_smoke.py Performance smoke test runner
  • Added memray memory profiling for 6 engine subsystems (action cycles, broadcasts, game state, locking, pubsub, rate limiting) qualify internal
    4 files
    • memray_action_cycle_stress.py
    • memray_broadcast_stress.py
    • memray_rate_limiting_stress.py
    • run_memray_stress.py
  • Comprehensive performance testing infrastructure with docs, smoke tests, benchmarks, and CI integration qualify internal
    1 file
    • run_performance_smoke.py

HTTP endpoint unit tests

2 files changed
  • RoomList.tsx Updated for endpoint tests
  • game.ts Type definition updates
  • Added unit tests for session service, tournament routes, screen endpoints, NPC personas, health check, room NPC claim, room settings, room list/detail, room join, room actions, and chat endpoints qualify internal
  • Added session management unit tests covering CAS/retry logic qualify internal
  • Removed hollow test files that do not exercise production code deprecate internal

Decouple game-specific logic from server infrastructure

1 file changed
  • RedactingPhase.tsx Decoupled from server infrastructure
  • Decoupled game-specific logic from server infrastructure and updated action cycle stress test to reflect production path decouple internal
    1 file
    • RedactingPhase.tsx

Memray optimization results documentation

2 files changed
  • PERFORMANCE.md Performance documentation
  • PERF_BASELINE.md Performance baseline documentation
  • Documented final memray iteration confirming all app-level memory hotspots have been addressed specify internal
  • Updated HANDOFF with complete session work and next priorities specify internal