(I also added the Faster/Slower/Pause buttons and the ring around the machine's head visible at slow speeds, moved the starting position to mid-canvas from upper left, and fixed a color-map entry.)
Update: Removed the sharing URL textbox in favor of the browser's URL bar.
Update: Adapted the Mutate button from ianiselsewhere, who also added cross-breeding, which you should totally check out.
Some timings on my laptop (a ThinkPad X1 Carbon running Firefox Nightly (2013 March) and Chrome 26, on Windows 7) for a particular Turing machine:
|Version of the code||Firefox time (nsec/step)||Chrome time (nsec/step)|
The frame rate on this page should be pretty close to the
original because in both versions it's limited by design, to
keep the action visible and the UI responsive. I've upped
the framerate while reducing the number of steps/frame to
keep the speed roughly constant, to take advantage of the
faster computation. (The code doesn't account for time spent
on screen update or waiting on
in either version.) You might prefer to leave the framerate
untouched and reap the advantage as a cooler CPU. (N.B. this
page chews up CPU even after the grid stops changing —
the Turing machine is just rewriting the same never-changing
One more change turned out to be needed: calls to the inner loop run much larger chunks (50,000 steps instead of 5,000). Each call into an asm.js function takes about 2 msec (at this writing): at the original finer granularity almost all the time was going into the asm.js trampoline, not actually computing anything.
Examples (from the README). Because the original code doesn't notice when you click to a new #fragment on the same page, and I don't want to mess with it, I've made the URL trivially different from the one you probably came in to (www.wry.me vs. wry.me). Just go back to the wry.me page to click on another example.