Optimized some of the render code a little bit. Games are starting to run.

Added a cache for the output. For some reason drawing on the canvas is
really slow, so now we only draw when the value has changed.