fengb / fundude

Gameboy emulator: Zig -> wasm
https://fengb.github.io/fundude/
MIT License
180 stars 8 forks source link

Optimize disassembler #46

Closed fengb closed 4 years ago

fengb commented 4 years ago

Extracted from https://github.com/fengb/fundude/issues/43

Disassembler increases the bundle size by ~15 KB (4 KB gzipped) due to extra string literals + dispatch table.

https://godbolt.org/z/fPaYQJ

fengb commented 4 years ago

Improved this slightly but not sure any more improvements can be made.

LLVM was most likely inlining Op.decode alongside the execution jump table then merging the two together, so Op.decode didn't technically exist.

Adding the disassembler forced the existence of the decoder jump table.