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

perf(object-hash): avoid splice method to insert values #35

Merged
merged 2 commits into from Apr 23, 2023

Conversation

H4ad
Copy link
Contributor

@H4ad H4ad commented Apr 22, 2023

Inspired by puleos/object-hash#122

perf: avoid splice method to insert values

If possible, I prefer to avoid splice and any other method to modify the array is is possible.

'splice x 8,139,878 ops/sec ±1.25% (89 runs sampled)',
'unshift x 7,932,324 ops/sec ±0.97% (94 runs sampled)',
'Array.prototype.push.apply x 14,664,082 ops/sec ±1.09% (90 runs sampled)'

Benchmark: bench-splice-vs-push-js

src/object-hash.ts Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Apr 22, 2023

Codecov Report

Merging #35 (ac8608b) into main (23431de) will decrease coverage by 0.27%.
The diff coverage is 66.66%.

❗ Current head ac8608b differs from pull request most recent head 49a1968. Consider uploading reports for the commit 49a1968 to get more accurate results

@@            Coverage Diff             @@
##             main      #35      +/-   ##
==========================================
- Coverage   80.37%   80.10%   -0.27%     
==========================================
  Files           8        8              
  Lines         968      980      +12     
  Branches      125      127       +2     
==========================================
+ Hits          778      785       +7     
- Misses        190      195       +5     
Impacted Files Coverage Δ
src/object-hash.ts 62.97% <66.66%> (-0.15%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@pi0 pi0 merged commit 69a82bf into unjs:main Apr 23, 2023
1 check failed
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.

None yet

2 participants