I believe the SGDK2 code is smart enough not to draw sprites that don't intersect the visible view on the screen. You shouldn't have to rely on the browser's smarts for that.
for(si = 0; si < this.sprites.length; si++) {
var curSprite = this.sprites[si];
if (!curSprite.isActive) continue;
var frames = curSprite.getCurFrames();
if (frames == null) continue;
var frameSet = frameSets[curSprite.states[curSprite.state].frameSetName];
if (typeof frames == 'number')
frameSet.frames[frames % frameSet.frames.length].draw(ctx, curSprite.x + this.currentX, curSprite.y + this.currentY);
else
for(var fi = 0; fi < frames.length; fi++)
frameSet.frames[frames[fi] % frameSet.frames.length].draw(ctx, curSprite.x + this.currentX, curSprite.y + this.currentY);
}
Okay, I must either be fatally
misunderstanding something in MapLayer.js or I'm
using an earlier version of SGDK2. Where in your Javascript code is it checking for whether it's within the visible rectangle? If I am, I'm sorry, please correct me!

(Either way, I manually wrote a check that would only draw sprites within the visible region of the screen using curSprite.layer.currentX/Y.)
Consistent speed was my reason for using a method like setInterval to draw frames instead of requestAnimationFrame. Did you consider comparing the result against the stock SGDK2 behavior with a constant (low) frame rate limit set. Of course if you set the limit too high, it won't be hit, but if you set it appropriately low, it should be relatively consistent.
I'd say I'm having smoother performance with the edits:
The only frame-rate that the original code was consistent at was 15FPS (At least on my slower Android phones) (PC seemed to be a mixed bag, but it was slightly higher around 25FPS). That original code was even more capricious in performance than this code I'm using now

The setInterval handler was reported by Chrome to take around 100ms, sometimes even reaching 200ms for scenes with tons of tiles.
With this newer code, performance is stable at 25FPS on even the worst phone I can find. My requestAnimationFrame handler is reported to take 50-60ms at worst on an Android webview, which is close enough to 25FPS to not make things noticeable, despite flagging a Violation in console.
Are you also aware that you can pre-create most sprite instances and use "ActivateSprite" instead of add sprite so that you're not creating and deleting objects?
Nice trick. It was mainly the tile drawing that I made changes to, not the sprite drawing. Tons of local variables are created it seems whenever tiled layers are drawn and I'm trying to refactor this to only use global variables rather than polluting with local variables.
So I never call the AddSpriteHere method. As a Javascript developer I've had issues in the past with the garbage collector for high sprite games, and for things such as bullets, I try to create once them and activate them, then move them to where I need them.
The ActivateSprite is a rule I hadn't seen, I've been manually activating these by setting their properties. I'll look at it.
Most of the performance variance I have isn't coming from me creating or destroying objects, it seemed that it laid somewhere within the rendering code, and ctx.drawImage() was probably one of many other things I had to look into.
