When I first began re-re-writing Syndrome
Well ... the first attempt was not all that impressive. In fact, it was downright disheartening at 2.023 seconds on Gecko
1.9.1 running on a 2.8 GHz Core 2 Duo.. After some major refactoring, it got a good bit faster at 0.486 seconds on Gecko 1.9.2. Still a few orders of magnitude away from the raw performance of C.
increased the speed even further, down to 0.16 seconds. And doing the same kind of hack on the palette cache brought it down to the current 0.15 seconds.
At this point, it is still ~17x slower than the raw C drawing code. But there is still many more opportunities for optimization. Converting many of the array buffers to JS Typed Arrays will likely help dramatically, still. The ROM buffer would probably show the biggest improvement, along with the accessor methods for pulling different data sizes from the buffer. And Web Workers can push the actual rendering into background threads making the actual drawing look like it completes instantly. And of course, for pure überspeed, writing a dynamic library in C that does pixel-pushing, and calling into it with js-ctypes