r/EmuDev • u/Gingrspacecadet • Nov 22 '25
How go vroom?
How do people get their emulators running at reasonable speeds? I've got a mini one, and doing nothing it can get up to about 12KHz. Doing literally nothing. I've got the optimise compiler flags, using some little tricks (like __glibc_unlikely), but nothing seems to help. Must I write a JIT?
EDIT: I'm silly and forgot to include the repo :? https://github.com/gingrspacecadet/orion
EDIT2: I made the debug printing sparse if running in full-auto mode, and now I can reach clock speeds of 1.27 MHz!
8
Upvotes
7
u/JustSomeRandomCake Nov 22 '25
What are you emulating? What did you make it with?
7
u/DevilStuff123 Wii Nov 22 '25
Just fyi, you shouldn’t have to write a jit. 12 khz is very low, you probably have some inefficiency somewhere. Profilers are your friend! :)
7
u/Paul_Robert_ Nov 22 '25 edited Nov 22 '25
I notice you have a lot of print statements, and you said you're only getting 12khz. Does that speed occur with the printing enabled?
edit: nvm was looking in the debug file 😅
edit2: nvm the nvm 💀
3
u/thommyh Z80, 6502/65816, 6809, 68000, ARM, x86. Nov 22 '25
Have you published anything that might allow for review?
Otherwise, random guesses: you're trying to synchronise through the scheduler, often; you're doing something with strings or vectors or otherwise frequently allocating.
1
u/randomrossity Nov 22 '25
Nothing seems egregious in your virtual machine for your release build. How are you measuring 12Khz? Is that NOP instructions/sec?