Swizz / snabbdom-pragma

'NotReact.createElement' jsx pragma although for snabbdom
MIT License
47 stars 16 forks source link

Optimize code for performance #33

Closed blikblum closed 6 years ago

blikblum commented 6 years ago

This PR do various optimizations:

It keeps the same general structure of the code

blikblum commented 6 years ago

These are the benchmark numbers after the optimizations:

Benchmarking no props hyperscript x 13,679,844 ops/sec ±0.91% (94 runs sampled) jsx-base x 710,921 ops/sec ±0.63% (95 runs sampled) jsx-new x 2,961,512 ops/sec ±0.91% (96 runs sampled) no props - fastest is hyperscript fastest JSX is [ 'jsx-new' ]

Benchmarking simple props hyperscript x 12,633,025 ops/sec ±0.98% (96 runs sampled) jsx-base x 43,821 ops/sec ±0.59% (99 runs sampled) jsx-new x 96,979 ops/sec ±0.71% (95 runs sampled) simple props - fastest is hyperscript fastest JSX is [ 'jsx-new' ]

Benchmarking module object props hyperscript x 9,662,792 ops/sec ±0.95% (97 runs sampled) jsx-base x 39,237 ops/sec ±3.05% (89 runs sampled) jsx-new x 75,822 ops/sec ±1.11% (92 runs sampled) module object props - fastest is hyperscript fastest JSX is [ 'jsx-new' ]

Benchmarking modules attribute props hyperscript x 9,278,690 ops/sec ±1.09% (95 runs sampled) jsx-base x 29,787 ops/sec ±0.78% (95 runs sampled) jsx-new x 47,256 ops/sec ±0.70% (96 runs sampled) modules attribute props - fastest is hyperscript fastest JSX is [ 'jsx-new' ]

Benchmarking real world form jsx-base x 2,951 ops/sec ±1.59% (96 runs sampled) jsx-new x 6,306 ops/sec ±0.80% (92 runs sampled) real world form - fastest is jsx-new fastest JSX is [ 'jsx-new' ]

Swizz commented 6 years ago

I will sum up the changes and make a release soon :tm:

Swizz commented 6 years ago

Npm published with v2.7.0