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

Benchmark diff implementations #18

Open
sdgluck opened this issue Mar 29, 2017 · 6 comments
Open

Benchmark diff implementations #18

sdgluck opened this issue Mar 29, 2017 · 6 comments

Comments

@sdgluck
Copy link
Owner

sdgluck commented Mar 29, 2017

In #16 @bali182 discussed the various options for removing an element from an array by index. Would be nice to benchmark the different available approaches.

@bali182
Copy link
Contributor

bali182 commented Mar 29, 2017

@sdgluck any idea how we should go about this? I don't think this should live in this repo, but it would be nice to have this (among other things) tested in both various browsers and node. I tried jsPerf, but it's a mess, I couldn't even submit it, the server died on me before the tests were saved, after that the site wouldn't even load... Do you know of any tools that does this well? Google did not come up with much - at least not the first page :)

@bali182
Copy link
Contributor

bali182 commented Mar 29, 2017

We could use https://benchmarkjs.com/ but that is something we have to run on our own possibly using travis together with the tests :(

@sdgluck
Copy link
Owner Author

sdgluck commented Mar 29, 2017

I think having the benchmarks in the repository would be fine, under a benchmarks folder? That way they can be run through an npm script.

Benchmarks could be created using marky

@bali182
Copy link
Contributor

bali182 commented Mar 29, 2017

Sure, if you are OK with having in the repo :)

But regarding the tool for benchmarking, I don't think we should use a single run with a timer, that can be very circumstantial. I think we should use a benchmarking tool that runs each case a good number of times and draws the conclusion from that.

That's why I was looking at benchmark this seems to be the only benchmarking tool I could find for js, but not really sure how good or bad it is. I'll keep looking.

@bali182
Copy link
Contributor

bali182 commented Mar 29, 2017

Managed to get jsPerf workinging: https://jsperf.com/remove-by-index-from-array

Results (quite suprising - at least for me) - slicing then concatenating seems to be the fastest on all platforms and browsers.

Windows/Chrome:
jsperf-chrome-win

Windows/Firefox
jsperf-firefox-win

Mac/Chrome
jsperf-chrome-mac

Mac/Firefox
jsperf-firefox-mac

@sdgluck
Copy link
Owner Author

sdgluck commented Mar 30, 2017

Interesting results! Especially that Chrome seems to be significantly slower than Firefox in this regard.

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

No branches or pull requests

2 participants