steveluscher/react-supervanjs-2013 — pull request #1 by petehunt (2013-11-07 10:09:29+00:00)
Title: Quick pass

Sweet demo! Changed a few things around :)

1. I was concerned that perf was being sampled and logged so often that it would degrade performance. I switched to stats.js (the thing they use for three.js) and removed that code. Part of that removal included getting rid of the forced reflow. I wasn't sure what the point was of that so feel free to reject :) You can use stats.js in a more fine-grained way (as you were doing) too if you want (i.e. start() and end()).

Dropped this into `js/` (which needs to exist for this to run)

2. I refactored your code into a separate component which makes it a little more idiomatic.

3. I multiplied perf by adding `shouldComponentUpdate()`. If your app was rendering more complex things this would help even more than it does right now. This is the magic of React: it's usually "fast enough" out of the box (it was on par or beating native on everything I tried) and with a single line of code you can increase perf by an order of magnitude.

Note that to do this you need to avoid mutation so I slightly tweaked datasource.coffee not to reuse objects.