i-like-robots / hyperons

🔥 The fastest JSX to string renderer on the server and in the browser.
https://www.npmjs.com/package/hyperons
MIT License
45 stars 4 forks source link

Performance rewrite #25

Closed i-like-robots closed 5 years ago

i-like-robots commented 5 years ago

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:

 - 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:

coveralls commented 5 years ago

Coverage Status

Coverage increased (+0.5%) to 96.951% when pulling 392de5b17d14fcd285da4618da44b8d1e7ff7f71 on perf-improvements into e3eaaf947bd2d3f52b7c7f2eeabf17880a234414 on master.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+1.6%) to 98.077% when pulling a7b54ebd2ccc776b9d242f4053b69d997d246e4b on perf-improvements into 1c7a3dab75ed48b3665d1434a47786c6c75f7230 on master.