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): faster isNativeFunction check #30

Merged
merged 1 commit into from Apr 22, 2023

Conversation

H4ad
Copy link
Contributor

@H4ad H4ad commented Apr 22, 2023

Inspired by puleos/object-hash#122

perf: faster isNativeFunction check

Use slice to check if the native function instead of using regex.

'oldRegex x 13,961,935 ops/sec ±2.56% (83 runs sampled)',
'endsWith x 43,583,325 ops/sec ±0.46% (94 runs sampled)',
'slice x 1,133,185,926 ops/sec ±0.59% (93 runs sampled)',
'for x 160,559,673 ops/sec ±0.15% (93 runs sampled)'

Benchmark: bench-is-native-function.js

@codecov
Copy link

codecov bot commented Apr 22, 2023

Codecov Report

Merging #30 (7a27620) into main (23431de) will decrease coverage by 0.03%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main      #30      +/-   ##
==========================================
- Coverage   80.37%   80.34%   -0.03%     
==========================================
  Files           8        8              
  Lines         968      972       +4     
  Branches      125      125              
==========================================
+ Hits          778      781       +3     
- Misses        190      191       +1     
Impacted Files Coverage Δ
src/object-hash.ts 63.23% <50.00%> (+0.12%) ⬆️

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

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart change!

@pi0 pi0 merged commit 939dc09 into unjs:main Apr 22, 2023
1 of 3 checks passed
@H4ad H4ad deleted the perf/faster-native-function branch April 22, 2023 10:54
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