fengb / fundude

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

Single timer #61

Open fengb opened 3 years ago

fengb commented 3 years ago

Benchmarking shows all the subcomponents taking up non-trivial computation time. This includes Temportal, which 99% of the time is doing an increment followed by a compare. My hypothesis is that because each subcomponent has its own timer, it's creating unnecessarily duplicated work. This probably isn't much, but maybe we can eek 5-10% out.

Current architecture:

Proposed architecture:

fengb commented 3 years ago

The ticks show up when profiling individual pieces, but it seems like outside of profiling, the compiler somehow optimizes this away. Even after manually unrolling loops, I did not get any performance gains.