Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MegaDrive performance tuning #8

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

MegaDrive performance tuning #8

wants to merge 9 commits into from

Conversation

LukeUsher
Copy link

This is my preliminary work on performance tuning for the Megadrive core

On an iPhone 7, this brings the performance of Columns from 30-40fps (approx 19-20 ms per frame) to 59-61fps (approx 11-16ms).

On a desktop computer, with the frame limiter disabled, I have been able to hit 90-100fps.

Work has been submitted as several individual commits within this pull-request, each detailing the work that was done within the commit message. I highly recommend throughly reading those commit messages, but I will point to “part 4” specifically, as it contains a compile-time configurable option that can be used to fine tune emulated cpu clock speed.

Significant performance boost gained by:

1.  copying m68k core into md module, preventing virtual function call overhead
2. simplifying/optimizing conditional branches
3. disabling sega/mega cd support
4. helping the compiler to inline small functions with hints & moving some functions to header files
inline z80 core into the md apu class to avoid virtual function overhead
 - Agressive optimisation/caching of vdp fields to reduce per-line or per-pixel calculations
 - Use const where possible to better allow the compiler to optimize calls
- apu and cpu only check for interrupts per-block, rather than per-instruction
- cartridge is hard-coded to linear type, this will break Super Street Fighter II, but all other games should still work
- m68k cpu clock speed can be customised (see  higan/md/cpu/cpu.cpp)

fix an issue preventing most common Sonic & Knuckles roms from working out-of-the-box
 - Use templates within VDP to reduce per-pixel calculations/branches
 - Simplify APU interrupt handling, since MD only uses specific functionality here
- simplified apu interrupt handler (md doesn't use NMI or mode 2)
- more agressive inlining
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant