Bob

BSNES Runahead Mode Lag Tested

Today, developer Byuu released an alpha build of my favorite SNES emulator bsnes, that includes a latency-reducing “runahead mode“:  https://cirrus-ci.com/github/byuu/bsnes/master

I realize it’s still an alpha build, but I really wanted to see what the performance was like, so I broke out the high-speed camera and ran some lag tests!

Please keep in mind that this is just a quick test and not an in-depth overview.  I just wanted to get a basic idea of how bsnes has been running these days, as I haven’t done any formal testing with it in a long time.

To start out, I connected original SNES hardware through the OSSC, into my computer monitor which I’d previously measured with the Time Sleuth and found that it only had a few milliseconds lag.  I then loaded Super Metroid and used my LED-modded controller to measure the average time it takes for Samus to shoot, after the button was pressed:

Now, please keep in mind that this isn’t a perfect way to measure, as it can always be off by about one frame.  I’ll have a much more detailed post on lag soon, but in short, if the button command is read before the frame starts to be drawn, then you can see readings of around 16 milliseconds faster than if it was read after the frame has already started drawing.  There’s also the fact that Samus’ gun isn’t locked to always shoot exactly the same way and if you press the button rapidly, you can see it fire at a different pace.

So, once again, not a perfect measurement, but a decent real-world test to see how things compare.

It looks like our baseline measurements above ranged between 57 and 83 milliseconds; 3-5 frames.  That’s just about what I expected and a decent general number to start from.  So now let’s move on to measure bsnes on my desktop PC with a USB controller that also has an LED installed.  I’ll start with runahead turned off, to get a baseline reading there:

Here we’re showing latency between 66 and 113 milliseconds, or 3-7 frames of latency; About two frames more than an original console.  That’s not bad at all, although the wider gap between the varying delay might be noticeable to some people.  Now let’s check out my desktop PC with runahead mode set to one frame:

This time we range between 57 and 116 milliseconds – no difference from when it was off.  I think the issue is my PC just isn’t fast enough to process the runahead mode.  My desktop PC has an older 2nd generation i7 processor with a GeFore GTX 1070 graphics card and 16GB of RAM.  My laptop has a much newer 8th generation i7 processor, with 32GB of RAM and a GeForce RTX 2070 graphics card…and supposedly a low-lag screen.  Now I’ll give that a try:

After measuring, the laptop has a baseline reading of between 48 and 85 milliseconds, which is about the same as original hardware.  Please keep in mind that this is a section of the game with nothing else on the screen but Samus and no new data is scrolling by – The only “processing” is Samus shooting.  Still, that’s really impressive for software emulation and we haven’t even turned on runahead mode yet!

Now with runahead mode on, it looks like we’re getting between 37 and 74 milliseconds – between 2 and 5 frames.  That’s pretty impressive, as it shows that it’s technically possible to sometimes have a reaction that’s faster than the original console.

Please don’t take this out of context and think emulation is “faster” than original hardware!

This is a controlled test in one basic part of the game.  I imagine if I chose a part of the game like a boss fight with tons of information on the screen that it wouldn’t perform as well.  It does demonstrate that runahead is working though and shows some potential for people with really fast computers.

Lastly, I tried raising the runahead to four frames and it didn’t make much of a difference:

I didn’t expect it to though, as this wasn’t a high latency game to begin with and there’s only so much you can skip ahead.  For your use, I’d recommend sticking to one or two frames and seeing how it performs.

Now, I just want to make sure I’m 100% clear that I’m using a really fast laptop and most people shouldn’t expect this performance.  In fact, most slower PC’s won’t run bsnes at all and I bet even with this laptop, results will be much different during a processor-intensive part of the game.  This is still a great sign that emulation latency is getting so low, that someday we won’t need top of the line equipment to get this performance from it.  While this feature is still in alpha stage, I highly recommend giving it a try and seeing if your computer can handle it.

Liked it? Take a second to support Bob on Patreon!