Profiling and Optomisations
Over the last few weeks i’ve been looking into how fast SpeccyDS currently runs and how it can be optomised to handle some of the new features. Therefore, I added a simple speed meter that displays the percentage speed when compared to a real Spectrum. The results were quite suprising…
When idling in Spectrum BASIC, SpeccyDS ran at 134% of a real Spectrum. When under load (I used the menu screen of Cobra), the speed fell to 116%. Far to low for my liking.
I knew that my display routines were not the best in the world. I had put them together with a ‘just get it working’ attitude and I knew that there were savings to be had. With this in mind, I tried disabling them so I could just measure the speed of the CPU core. The speed jumped up to a massive 495%/312% (BASIC/Cobra)!
Obviously there was something seriously wrong in the display routines. After a lot of swaping and re-coding, i’ve managed to get the speed up to a much more impressive 210%/168%. The change in the code will also let me use the DS hardware to scale the Spectrum display to allow borders to be shown. I’m not sure how practical this will be, but it will be nice to have the option.
Unfortunatly, this speed boost seems to have broken my sound code. It doesn’t look like the CPU syncronisation enjoys going over the 200% speed barrier. It is a bit odd to have problems because SpeccyDS is running too fast 🙂