facebook/react — pull request #895 by spicyj (2014-01-15 01:52:44+00:00)
Title: Make findComponentRoot faster with more nodeCache

This is an alternative, less-invasive, fix for #891.

Test Plan: On http://jsbin.com/OqOJidIQ/2/edit, got timings like

[75, 56, 30, 36, 27, 27, 28, 32, 27, 27, 28, 31]

instead of the old

[75, 729, 46, 32, 28, 34, 26, 27, 27, 30, 26, 26].

I also added a counter to getID and saw it was called 3014 times instead of
the old 636264. (3014 is the number of nodes (3000) plus 3 calls that happen
for the initial render and 1 for each of the 11 renders after that.)

---

TODO:

- [ ] Figure out whether I need to use isValid
- [ ] Make the ancestor traversal not allocate a function