Fix performance regressions in tree.js (fixes #2396)
Add mutating extent extend, for performance