dlv
dlv copied to clipboard
Shrink by using reduce
Before:
122 B: dlv.js.gz
91 B: dlv.js.br
121 B: dlv.es.js.gz
97 B: dlv.es.js.br
198 B: dlv.umd.js.gz
160 B: dlv.umd.js.br
After:
117 B: dlv.js.gz
82 B: dlv.js.br
116 B: dlv.es.js.gz
81 B: dlv.es.js.br
188 B: dlv.umd.js.gz
148 B: dlv.umd.js.br
this is smaller than the for in patch, and more performant by looking at this esbench. On par with the for loop: https://esbench.com/bench/5ce6eafa4cd7e6009ef6252b
On par with the for loop: esbench.com/bench/5ce6e64a4cd7e6009ef62526
Looks like your link doesn't have reduce version, could you recheck/update please?
https://esbench.com/bench/5ce6eafa4cd7e6009ef6252b
Thanks! As expected, particular results differ between browsers - this one is from Firefox - but at least it's indeed better perf-wise than for-in version:
Sorry for taking so long to reply here. The benchmark needs a bunch of different source objects and many variants of key in order to produce valid results. Currently since it's the same object and key passed every time, it's benchmarking a cache.