This is a total rewrite of the create element and render functions, the result of which is a > 30% performance improvement.
Refactors the create element method to only return only a lightweight representation of the element.
Rewrites the render method to minimise the number of loops used.
These changes were made after noticing that the performance of the Inferno and Rax libraries was very similar despite them needing to perform more work. I took cues from both of these tools.
Previous benchmark:
- Hyperapp x 7,729 ops/sec ±1.41% (89 runs sampled)
- Hyperons x 9,393 ops/sec ±0.60% (95 runs sampled)
- Inferno x 9,558 ops/sec ±0.31% (95 runs sampled)
- Nerv x 4,880 ops/sec ±0.84% (94 runs sampled)
- Preact x 4,418 ops/sec ±0.15% (96 runs sampled)
- Rax x 9,731 ops/sec ±0.59% (93 runs sampled)
- React x 5,020 ops/sec ±1.12% (93 runs sampled)
- vdo x 6,234 ops/sec ±0.22% (96 runs sampled)
Updated benchmark:
- Hyperapp x 7,764 ops/sec ±1.39% (87 runs sampled)
- Hyperons x 13,078 ops/sec ±1.42% (94 runs sampled)
- Inferno x 9,563 ops/sec ±0.62% (95 runs sampled)
- Nerv x 4,816 ops/sec ±0.85% (94 runs sampled)
- Preact x 4,312 ops/sec ±1.06% (94 runs sampled)
- Rax x 9,699 ops/sec ±0.44% (93 runs sampled)
- React x 5,025 ops/sec ±1.55% (94 runs sampled)
- vdo x 5,892 ops/sec ±0.36% (96 runs sampled)
All tests are passing with only minor changes:
Removed recently added test for lowercasing attribute names as browsers do this implicitly so lowercasing adds unnecessary overhead (~5%)
Updated mixed children args and children props spec. Children args should always be favoured over props for consistency with other libraries.
Coverage increased (+0.5%) to 96.951% when pulling 392de5b17d14fcd285da4618da44b8d1e7ff7f71 on perf-improvements into e3eaaf947bd2d3f52b7c7f2eeabf17880a234414 on master.
Coverage increased (+1.6%) to 98.077% when pulling a7b54ebd2ccc776b9d242f4053b69d997d246e4b on perf-improvements into 1c7a3dab75ed48b3665d1434a47786c6c75f7230 on master.
This is a total rewrite of the create element and render functions, the result of which is a > 30% performance improvement.
These changes were made after noticing that the performance of the Inferno and Rax libraries was very similar despite them needing to perform more work. I took cues from both of these tools.
Previous benchmark:
Updated benchmark:
All tests are passing with only minor changes: