Re: Invitation to test the iOS edition of BBC BASIC

Richard Russell
 

After some rather intense 'forensic debugging' I've discovered what was making the graphics so slow on iOS - a 'feature' of SDL2, when running on iOS (only), which results in the SDL_PumpEvents function (and the SDL_PollEvent function, which calls it) running very slowly.   It's even commented in the code of SDL if you know where to look: 

    /* Let the run loop run for a short amount of time: long enough for
       touch events to get processed (which is important to get certain
       elements of Game Center's GKLeaderboardViewController to respond
       to touch input), but not long enough to introduce a significant
       delay in the rest of the app.
    */
    const CFTimeInterval seconds = 0.000002;

Two microseconds may not sound like much, but it's an age on a modern CPU (and in fact I suspect the pause is much longer).  The comment "not long enough to introduce a significant delay in the rest of the app" is far from the case with BBC BASIC!

Fortunately a workaround in my code was possible, so those of you who have downloaded the iOS edition of BBCSDL please replace it with the latest version.  You should notice a worthwhile speed improvement, indeed in a few cases it will be very marked (I reckon 'scarab.bbc' is now running about a hundred times faster than it was!).

Richard.

Join bb4w@groups.io to automatically receive all group messages.