Skip to content

ppcexec: Avoid excessive timer polling in realtime mode - #235

Merged
dingusdev merged 1 commit into
dingusdev:masterfrom
mihaip:upstream-realtime-timers
Oct 10, 2026
Merged

dingusdev merged 1 commit into
dingusdev:masterfrom
mihaip:upstream-realtime-timers

Conversation

@mihaip

@mihaip mihaip commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

When the interpreter can run faster than realtime (depends on the host system's performance), we would end up checking timer more frequently.

This is because the max_cycles value returned by process_events() was based on the absolute timer deadline converted to instruction counts. Once g_icycles got ahead of that value, we would check timers after every instruction.

Instead, use the time remaining until the next timer to schedule an instruction batch relative to g_icycles, capped using the existing 500us polling interval.

When the interpreter can run faster than realtime (depends on the
host system's performance), we would end up checking timer more
frequently.

This is because the `max_cycles` value returned by `process_events()`
was based on the absolute timer deadline converted to instruction
counts. Once `g_icycles` got ahead of that value, we would check timers
after every instruction.

Instead, use the time remaining until the next timer to schedule an
instruction batch relative to `g_icycles`, capped using the existing
500us polling interval.
@dingusdev
dingusdev merged commit 6f87662 into dingusdev:master Oct 10, 2026
7 checks passed
mihaip added a commit to mihaip/infinite-mac that referenced this pull request Oct 10, 2026
Required to make typing work better (BeOS appears to use the decrement
interrupt or other CPU mechanism for the key repeat delay, and synthetic
time was causing too many key events to be generated).

With dingusdev/dingusppc#235 and mihaip/dingusppc@3386136
realtime mode should be reasonably efficient in the DingusPPC Emscripten
build.

For #237
@mihaip
mihaip deleted the upstream-realtime-timers branch October 11, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants