perf(vapor): store the GBA font as 1bpp and expand it at upload - #392
Open
lfkdsk wants to merge 1 commit into
Open
perf(vapor): store the GBA font as 1bpp and expand it at upload#392lfkdsk wants to merge 1 commit into
lfkdsk wants to merge 1 commit into
Conversation
lfkdsk
force-pushed
the
fleet/vapor-gba-font-1bpp
branch
from
September 8, 2026 21:17
a0b5c3b to
1b452c1
Compare
The GBA target expanded the 760 B 1bpp FONT8 bitmap into a 3040 B 4bpp vp_font_tiles table at compile time, so every ROM carried 2280 B that the runtime can rebuild. Emit the same 1bpp table ESP32 and Playdate already use and expand it into VRAM inside upload_font, which already looped over those halfwords. todo.gba 9356 -> 7160 B (-2196, -23.47%), playdate-six-button.gba 6420 -> 4224 B (-2196, -34.21%), five identical measurement runs per side. The saving reconciles in the symbol table: vp_font_tiles 3040 -> 760 B minus 84 B of expansion code in main. GB, NES, ESP32 and Playdate generated C is byte-identical and their ROMs compare equal. All 3040 bytes reaching VRAM are unchanged, verified by dumping the font charblock out of a booted ROM in headless libmgba rather than by reimplementing the expansion in TS. That dump is the new vapor/tests/gba-font.test.ts, which exists because GBA parity cannot see this surface: its probe is the screenblock at 0x6004000, so it reads tile indices and palette banks, never glyph pixels — with the two halfword stores swapped, parity still passes 6/6 while the new test fails. bun test vapor/tests/: 74 pass / 0 fail (71 baseline + 3), GBA, GB, NES and oracle parity green.
lfkdsk
force-pushed
the
fleet/vapor-gba-font-1bpp
branch
from
September 8, 2026 21:20
0683e71 to
0607a04
Compare
Contributor
Author
|
Rebased onto current |
lfkdsk
marked this pull request as ready for review
September 8, 2026 23:07
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.
What
The GBA font table
vp_font_tileswas emitted as 4bpp tiles (3040 B), which was 32.5% of the Todo ROM and 47.4% of the six-button ROM — larger than every code symbol combined. This change emits the font as 1bpp (760 B) and expands it into the 4bpp charblock insideupload_fontat boot.Measured
todo.gbaplaydate-six-button.gbaStable over 5 builds per side. The delta reconciles in the ELF symbol table: −2280 B of table, +84 B of expansion code. State RAM, overlay and reactive figures are unchanged.
Correctness
955a983b…), not by re-implementing the expansion.0x6004000; glyphs live at0x6000020), so this addsvapor/tests/gba-font.test.ts, which reads VRAM back from a booted ROM. Three runtime mutations (halfword order, ink/paper swap, row overrun) each make it fail while parity stays green.vapor.h, so only generated-C identity is claimed for those two.bun test vapor/tests/: 74 pass / 0 fail (was 71), including GBA, GB, NES and oracle parity.Provenance
Produced by an autonomous fleet run: a Scout task measured the size baseline and proposed this candidate with a hand-patched prototype; a Builder implemented it; three independent cross-family reviews (different model families) rebuilt the ROMs, re-dumped VRAM and re-ran the mutations. The Scout report lives on the fork branch
lfkdsk/pocketjs:fleet/scout-artifact-size; this PR carries only the implementation and its tests.🤖 Generated with Claude Code