shish / rosettaboy

A gameboy emulator in several different languages
MIT License
469 stars 22 forks source link

[pxd] Some easy performance wins and fixups. #124

Open will-ca opened 1 year ago

will-ca commented 1 year ago

I very quickly tested most of these back in December, but got sidetracked before doing it properly for a PR and have had them on my list to go back to ever since.

It's time for me to admit that I have no idea when or if I'm going to get around to that, so here's the notes. Maybe posting this issue will jolt me to go back to this, but who knows 🤷.

Don't install MyPy for Cython.

MyPy's not needed for the Cython version.

Previously I removed it from shell.nix as a last-minute change, but forgot to remove it from py_env.sh.

Disable profiling. (\~+10%?) Disable bounds checking. Remove cpdef and cdef public. (\~+15%?)

You may need to do a git clean -Xi to generate new C sources.

Add notes, but don't implement:

Switch RAM.data to pointer? (\~+10%?) int addr in RAM.get (\~+10%?)

(IIRC I wasn't sure about implementing the last two because they change the code semantics and thus could be considered unfair/not a 1:1 equivalence to the other implementations.)