Is there a good reason not to use WebGL to render the scene and compute the character mapping? Even if you're dead set on outputting text to a `<pre>` you could write the ascii values out to a framebuffer and copy from that for a pretty significant speedup.