ZeroEffect
New member
I've started working on a GameBoy emulator for fun and would like some opinions on several performance related questions:
Opcodes:
Should I directly handle all opcodes in one giant switch statement? The compiler (VC++ in my case) should convert this into a jump table improving speed. Or, would I have better performance breaking down the switch statement into multiple switch statements (based on the opcode) adding in a small amount of overhead for the function call? Obviously, in both cases I will be losing code readability but I'm looking for straight performance.
What about the idea of a function call lookup table?
Although I really shouldn't have to worry about performance for a GB emulator on my current system I would like the practice if/when I move onto a more recent console.
Graphics:
When would be the best time to call my drawing routine? If I want to lock it in at 60fps max then I would call immediately before/after the VBlank interrupt. However, if I wanted to max my frame rate, should I call a draw after each instruction... This seems wasteful, is there a better way?
Thanks,
ZeroEffect
Opcodes:
Should I directly handle all opcodes in one giant switch statement? The compiler (VC++ in my case) should convert this into a jump table improving speed. Or, would I have better performance breaking down the switch statement into multiple switch statements (based on the opcode) adding in a small amount of overhead for the function call? Obviously, in both cases I will be losing code readability but I'm looking for straight performance.
What about the idea of a function call lookup table?
Although I really shouldn't have to worry about performance for a GB emulator on my current system I would like the practice if/when I move onto a more recent console.
Graphics:
When would be the best time to call my drawing routine? If I want to lock it in at 60fps max then I would call immediately before/after the VBlank interrupt. However, if I wanted to max my frame rate, should I call a draw after each instruction... This seems wasteful, is there a better way?
Thanks,
ZeroEffect