mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 10:19:47 -04:00
bbe0d2ae8e
Tomba2's Trolley attract demo interprets a working set past 64K distinct PCs. The per-PC tracking tables (g_dirty_ram_pc_table / exec_pc_table) used an UNBOUNDED linear probe, so once a table filled, every lookup for an absent PC scanned all 65536 slots before returning NULL — per executed instruction. Host thread profile showed ~99% of emu-thread time inside pc_table_get_or_insert_in; guest crawled at 0.3 fps (1M guest cycles per 3s wall) while telemetry showed the window "LIVE" on residual motion. Fix: hard-bound the probe to 128 slots (miss => NULL => "stop tracking", the documented degradation) and grow the tables 65536 -> 262144 so the Trolley working set actually fits — the same table feeds overlay-capture seed lists (MAX_CAPTURE_PCS aliases it), so the old size also silently truncated capture manifests for large regions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>