Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shrink by using reduce #36

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

mikesherov
Copy link

@mikesherov mikesherov commented May 23, 2019

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

@mikesherov
Copy link
Author

@RReverser
Copy link
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants