perf(game): eliminate per-event allocations via ScratchArena

Game::likelihoods previously allocated four Vecs (teams, diffs, ties,
margins) on every call. Batch now owns one ScratchArena reused across
all Game::new calls in the iteration loop; likelihoods() clears and
extends the arena buffers instead of allocating fresh.

For log_evidence (called infrequently), a local ScratchArena is created
per invocation so the method signature stays &self.

Also: add #[derive(Debug)] to TeamMessage and DiffMessage (required by
ScratchArena's own Debug derive).

Part of T0 engine redesign.
This commit is contained in:
2026-04-24 07:24:29 +02:00
parent 49d2b317da
commit b1e0fcb817
6 changed files with 234 additions and 61 deletions

View File

@@ -9,6 +9,7 @@ use std::{
pub mod agent;
#[cfg(feature = "approx")]
mod approx;
pub(crate) mod arena;
pub mod batch;
pub mod drift;
mod error;