-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat(benchmark): add defu
to compare with
#486
Conversation
I might have used Loading benchmark data file.
Running benchmarks for data set "tall" (1 of 3):
┌─────────┬──────────────────────┬─────────────┬────────────────────┬──────────┬──────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼──────────────────────┼─────────────┼────────────────────┼──────────┼──────────┤
│ 0 │ 'deepmerge-ts' │ '517,389' │ 1932.7816774650069 │ '±0.28%' │ 5173891 │
│ 1 │ 'deepmerge' │ '3' │ 283752828.8611113 │ '±3.94%' │ 36 │
│ 2 │ 'defu' │ '1,116,263' │ 895.8455933085199 │ '±0.27%' │ 11162638 │
│ 3 │ 'merge-anything' │ '690,933' │ 1447.316283031864 │ '±0.26%' │ 6909340 │
│ 4 │ 'object-accumulator' │ '9' │ 101954385.53535335 │ '±1.49%' │ 99 │
│ 5 │ 'lodash merge' │ '5' │ 192098338.07547063 │ '±0.39%' │ 53 │
└─────────┴──────────────────────┴─────────────┴────────────────────┴──────────┴──────────┘
Running benchmarks for data set "wide" (2 of 3):
┌─────────┬──────────────────────┬─────────┬────────────────────┬───────────┬─────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼──────────────────────┼─────────┼────────────────────┼───────────┼─────────┤
│ 0 │ 'deepmerge-ts' │ '2' │ 403044879.9999984 │ '±0.09%' │ 25 │
│ 1 │ 'deepmerge' │ '0' │ 10142960707.999985 │ '±0.00%' │ 1 │
│ 2 │ 'defu' │ '2' │ 412902348.2400016 │ '±3.19%' │ 25 │
│ 3 │ 'merge-anything' │ '1' │ 951229765.0909168 │ '±11.77%' │ 11 │
│ 4 │ 'object-accumulator' │ '177' │ 5644815.621895985 │ '±1.92%' │ 1772 │
│ 5 │ 'lodash merge' │ '1' │ 618995225.4117645 │ '±2.30%' │ 17 │
└─────────┴──────────────────────┴─────────┴────────────────────┴───────────┴─────────┘
Running benchmarks for data set "mid" (3 of 3):
┌─────────┬──────────────────────┬─────────┬────────────────────┬──────────┬─────────┐
│ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │
├─────────┼──────────────────────┼─────────┼────────────────────┼──────────┼─────────┤
│ 0 │ 'deepmerge-ts' │ '23' │ 42636126.81276876 │ '±1.98%' │ 235 │
│ 1 │ 'deepmerge' │ '0' │ 2439054750.0000043 │ '±1.43%' │ 5 │
│ 2 │ 'defu' │ '64' │ 15539177.942545502 │ '±0.45%' │ 644 │
│ 3 │ 'merge-anything' │ '26' │ 37383370.03731453 │ '±2.42%' │ 268 │
│ 4 │ 'object-accumulator' │ '154' │ 6478492.177460992 │ '±0.12%' │ 1544 │
│ 5 │ 'lodash merge' │ '2' │ 386707298.0384613 │ '±3.00%' │ 26 │
└─────────┴──────────────────────┴─────────┴────────────────────┴──────────┴─────────┘ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #486 +/- ##
==========================================
- Coverage 99.50% 99.37% -0.14%
==========================================
Files 8 8
Lines 1224 1276 +52
Branches 111 119 +8
==========================================
+ Hits 1218 1268 +50
- Misses 6 8 +2 ☔ View full report in Codecov by Sentry. |
Hey, I wasn't aware of that project but I'm happy to add it to the benchmarks. I had a quick look at the project and I would indeed expect it to be quite a bit faster than this one; as it's much more minimal. Performance is definitely important to this project but we're quite feature-rich compared to other similar projects. This prevents us from being the fastest as we need to do a few more checks during the merge process. If performance is most important to you, we're probably not the best choice (the best option in that case would probably be to roll your own merging function optimized for your needs). |
# [7.1.0](v7.0.3...v7.1.0) (2024-07-20) ### Features * **benchmark:** add `defu` to compare with ([#486](#486)) ([93599b4](93599b4))
🎉 This PR is included in version 7.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi @RebeccaStevens 👋!
I hope I am not bringing a bad news with this PR, nor any negative feelings!
I've created a PR on Storybook, where I am trying to replace
lodash/merge
andlodash/mergeWith
with an alternative.Initially I thought of your package, because it was the only one I knew so far.
Until I learned about
defu
.Naturally, I had answer one of question - performance. You have done an outstanding work on this package, because you have benchmarks, where it was easy to add
defu
to compare with.It looks like
defu
wins with a big margin, but I am giving a benefit of the doubt to know if my benchmark setup is wrong, or I am missing something.Results
Device: MacBook Pro M2
Results during invalid usage - before fix
Results after the possible fix
While Storybook has just a simple need for
merge
. I still want to give your package a chance. Do you think there's any other reason you believe they should favour your package overdefu
?