Repository navigation
Jump tables for the Game Boy, MSX, SMS, PICO-8, Jedi Knight and NES cores (2-12% less CPU per frame) - #32
Merged
Conversation
…ores ESP-IDF builds everything with -fno-jump-tables -fno-tree-switch-conversion: a table in flash breaks code that must run while the cache is disabled. The game cores run from their PSRAM overlay with the cache on, and a switch's table moves into the overlay with the core's other read-only data (Genesis, GBA, SNES and MGS were already built this way). Measured on the Tab5, the game thread's CPU per presented frame over the same 15 s scene (gprof, PC sampling on both cores): Game Boy 7.29 -> 6.43 ms -12% MSX 9.11 -> 8.24 ms -10% SMS 8.82 -> 8.11 ms -8% PICO-8 3.79 -> 3.53 ms -7% Jedi Knight 15.20 -> 14.47 ms -5% (main menu) NES 6.69 -> 6.57 ms -2% Doom, Dark Forces and ScummVM measured within 1% and are left as they were. The MSX member of the overlay grows by 76 KB (285 KB); the overlay stays the size of its largest member, MGS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Turns jump tables back on for the Game Boy, MSX, SMS, PICO-8, Jedi Knight and NES cores. These are mostly interpreters whose opcode dispatch is a big
switch.-fno-jump-tables -fno-tree-switch-conversion, because a table in flash breaks code that runs while the cache is disabled..rodata, which moves into the overlay with the core's other read-only data.Measurements (Tab5)
The game thread's CPU per presented frame over the same 15 s scene, from PC sampling on both cores:
Memory:
-ftree-switch-conversionproduces byte-identical code for SMS. The dark Sonic seen while testing was the palette bug fixed in video: mask palette indices to the palette's size (fixes dark SMS sprites) #31.Testing
🤖 Generated with Claude Code
https://claude.ai/code/session_01SFCMzomCZ5wRHJN4sxwkvY