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

Perf improvements #8

Closed i-like-robots closed 6 years ago

i-like-robots commented 6 years ago
  1. change: Use custom string wrapper instead new String() test: https://jsperf.com/object-assign-property benchmark improvement: +16.6%

  2. ~change: Use object literals instead of Set and Map test: https://jsperf.com/object-property-vs-map-get benchmark improvement: -6.9%~ Slower!

  3. change: Test string before attempting to escape it test: N/A benchmark improvement: +14%

  4. change: Cache CSS props to avoid multiple regexp passes test: N/A benchmark improvement: +7%

Benchmarks before perf improvements are listed in #7.

Latest benchmark:

Benchmark run on Tue 17 Apr 2018 21:07:55 BST with Node v8.9.4

hyperapp@1.2.5
Requests per second:    2861.85 [#/sec] (mean)

hyperons@0.3.0
Requests per second:    3328.16 [#/sec] (mean) +50%

inferno@5.0.4
Requests per second:    2914.22 [#/sec] (mean)

nerv@0.3.0
Requests per second:    2366.11 [#/sec] (mean)

preact@8.2.7
Requests per second:    2480.64 [#/sec] (mean)

rax@0.6.0
Requests per second:    3320.25 [#/sec] (mean)

react@16.3.2
Requests per second:    2221.61 [#/sec] (mean)
coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.8%) to 98.592% when pulling e1c7b39db802fa25deea1e345b86dfc522c714ef on perf-improvements into c3ed3f0771419b232c8c3522217397106811bad1 on benchmarking.