Files
courier-emu/native
Cryan209andClaude Opus 5 67f6a7e172 Count the C5x's I/O accesses as they happen, not by scanning the log
courier_c5x_get_io_port_stats answered every query by walking the whole
m_io_events vector once per port. That vector is only cleared at reset, so
the scan was linear in the length of the run, and the bridge's ROM-load and
overlay-commit loops ask for the stats once per single-step: the cost of
committing a block grew with how much had already been committed.

Keep the six figures per port in IO_READ16 and IO_WRITE16 instead, the way
m_data_write_counts already does for data writes, and make the query an
array lookup. Replaying the event log over a five-million-instruction run
reproduces the new counters exactly, and a twenty-million-instruction run
of MAIN_2.3.31 gives byte-identical output.

At 139k events the sixteen-port query drops from 599us to 21us and stops
growing; a step(1) loop that samples one port goes from 0.12 to 0.52M
instructions per second.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 22:06:22 +12:00
..
2026-09-11 14:03:02 +12:00
2026-08-04 13:01:29 +12:00