colby-swandale / waterfoul

Gameboy emulator written in Ruby-lang
92 stars 7 forks source link

Initialize CPU instance variables #6

Closed eregon closed 4 years ago

eregon commented 4 years ago

This fixes a few warning: instance variable @halt not initialized warnings (seen when running with -w).

It also boosts performance significantly for TruffleRuby, because the set of instance variables is now stable in that class (instead of having many different variants).

With this, I get ~375FPS on Tetris with TruffleRuby master running in --jvm mode! (truffleruby 20.2.0-dev-a9555582, like ruby 2.6.5, GraalVM CE JVM [x86_64-linux]) Screenshot from 2020-05-10 14-35-53 For comparison, on my machine Tetris on MRI 2.6.6 is ~50FPS, and ~77FPS with --jit. On MRI 2.7.1 it's ~55FPS, and ~95FPS with --jit.

colby-swandale commented 4 years ago

Ah! Many thanks for cleaning this up and fixing my typos. 👍