touchHLE
touchHLE copied to clipboard
Meta-issue for hot loop performance stuff
We're lucky that Super Monkey Ball runs so well, there's been almost no performance optimisation effort put into this emulator so far. But that's no reason not to strive to improve! There's many potentially slow things we do that could be improved:
- No fastmem, dynarmic has to do all memory accesses through callbacks. Easy to fix though a risk for memory leaks and less-debuggable crashes considering that all pages are readable and writeable right now.
- Tons of HashMap lookups happen when dispatching an Objective-C message send
- Host-to-host message sends are especially inefficient right now, they look up the selector and sometimes class each time
- The way guest-to-host calls work might not be optimally efficient?
- There is no proper event loop, we just do polling every now and then sleep for five milliseconds inside
ns_run_loop
. Obviously not ideal, it was an expedient hack to bring down the CPU and energy use before the first release.
But this is all just speculation, what's really needed is to do some performance profiling on the hot code.
It would be nice if we had good FPS in debug builds but that's probably a different problem, maybe we need to do selective optimisations or something.
It's not quite full fastmem, but 85bf5910e07fc8b28758b0ed9eca81dc46d90e8a gets us most of the way there and has a dramatic effect, especially in debug builds.