tildeio / htmlbars

A variant of Handlebars that emits DOM and allows you to write helpers that manipulate live DOM nodes
MIT License
1.61k stars 193 forks source link

Make all nodes in expressions a fixed length #468

Closed krisselden closed 8 years ago

krisselden commented 8 years ago

The acceptExpression method of the htmlbars runtime is a source of a lot of V8 JIT churn because of BoundsCheck hoisting, if we made all the nodes the same length, just filling the empty slots with undefined, when the acceptParams and acceptHash loops caused the argument destructing BoundsCheck opcode to be hoisted outside the loop it would not cause a deopt because all nodes would be the same length.

rwjblue commented 8 years ago

Breakdown (after running the Ember test suite) of node.length counts:

Object {2: 8435, 3: 3323, 4: 2860, 5: 760}