Skip to content

Shrink by using reduce#36

Open
mikesherov wants to merge 1 commit into
developit:masterfrom
mikesherov:optimize
Open

Shrink by using reduce#36
mikesherov wants to merge 1 commit into
developit:masterfrom
mikesherov:optimize

Conversation

@mikesherov

@mikesherov mikesherov commented May 23, 2019

Copy link
Copy Markdown

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
image

@RReverser

Copy link
Copy Markdown
Contributor

On par with the for loop: esbench.com/bench/5ce6e64a4cd7e6009ef62526

Looks like your link doesn't have reduce version, could you recheck/update please?

@RReverser

Copy link
Copy Markdown
Contributor

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:

image

@developit

Copy link
Copy Markdown
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants