KestrelComputer / kestrel

The Kestrel is a family of home-made computers, built as much as possible on open-source technology, and supporting as much as possible the open-source philosophy.
http://kestrelcomputer.github.io/kestrel
Mozilla Public License 2.0
185 stars 10 forks source link

Speed up emulator significantly. #224

Closed sam-falvo closed 8 years ago

sam-falvo commented 8 years ago

This might also make MacOS version run acceptably too!

larsbrinkhoff commented 8 years ago

We're calling SDL_PollEvent after every instruction in @stefanberndtsson's Atari ST emulator. But it seems to run quite fine.

sam-falvo commented 8 years ago

SDL 1.2 or SDL 2.0? I'm using SDL 2.0.

sam-falvo commented 8 years ago

In any event, the results speak for themselves; you're free to test the code with and without the for-loop and observe the difference in speed. It's easily a factor of 10x or more improvement in performance on my Linux box.

sam-falvo commented 8 years ago

One bug that I cannot get rid of, again seemingly related to SDL 2.0, is that intermittently, SDL will block event processing until I move the mouse out and back inside of the emulator's window. It doesn't always happen, indicating a race condition between threads that SDL manages, I think. So, if you run the emulator and nothing seems to happen, try killing it and re-running it a few times. Eventually, you'll get proper behavior.

larsbrinkhoff commented 8 years ago

We went from 1.2 to 2.0 a few weeks back.

You're right! Frames per second went from 45 (already acceptable) to 75 on a decent but not top-of-the-line laptop. Hardly a factor 10x, though. But I'll take it!

larsbrinkhoff commented 8 years ago

https://github.com/stefanberndtsson/ostis if you're curious and/or an Atari ST fan.

sam-falvo commented 8 years ago

For me, it sped my emulator up from seconds per frame to frames per second. Though, I've never been very good at writing emulators; I think maybe my code just sucks. :)