Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

assert,util: improve deep comparison performance#61076

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
BridgeAR wants to merge4 commits intonodejs:main
base:main
Choose a base branch
Loading
fromBridgeAR:BridgeAR/2025-12-14-improve-assert-perf

Conversation

@BridgeAR
Copy link
Member

This combines minor performance improvements for edge cases as well as adding more tests for partialDeepStrictEqual, resolving a TODO, and fixing a bug while comparing invalid dates (not taking into account that extra properties might exist).

The performance gain is mostly for objects containing symbols. We do not have benchmarks for these and our current benchmarks will not show much difference.

See commit messages for details.

@nodejs-github-botnodejs-github-bot added assertIssues and PRs related to the assert subsystem. needs-ciPRs that need a full CI run. utilIssues and PRs related to the built-in util module. labelsDec 15, 2025
wellKnownConstructors.add(Float16Array);
}
.add(WeakSet)
.add(Float16Array);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's still behind a flag:

V(js_float16array, \
"Float16Array, Math.f16round, DataView.getFloat16, DataView.setFloat16") \

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That seems to just be a legacy part that was not cleaned up in V8. It is fully shipped, V8/Chromium has it enabled as well as all other engines and there is absolutely no way this will be removed again.

I think we should consider it shipped.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should remove the flag then

Copy link
Contributor

Choose a reason for hiding this comment

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

BridgeAR and ljharb reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@aduh95 thank you!

The property comparison of invalid dates regressed when startingto handle invalid dates as being equal.
This is a very small improvement for error creation.
@BridgeARBridgeARforce-pushed theBridgeAR/2025-12-14-improve-assert-perf branch from4f7303b to641e674CompareDecember 15, 2025 22:50
@codecov
Copy link

codecovbot commentedDec 16, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (14f02fc) to head (641e674).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@##             main   #61076   +/-   ##=======================================  Coverage   88.52%   88.53%           =======================================  Files         703      703             Lines      208538   208529    -9       Branches    40214    40207    -7     =======================================+ Hits       184615   184621    +6- Misses      15921    15925    +4+ Partials     8002     7983   -19
Files with missing linesCoverage Δ
lib/internal/assert/assertion_error.js95.97% <100.00%> (+0.03%)⬆️
lib/internal/util/comparisons.js99.70% <100.00%> (-0.30%)⬇️

... and39 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BridgeARBridgeAR added the request-ciAdd this label to start a Jenkins CI on a PR. labelDec 16, 2025
returnfalse;
for(constkeyofgetOwnSymbols(val1)){
if(hasEnumerable(val1,key)){
ArrayPrototypePush(keys1,key);
Copy link
Member

Choose a reason for hiding this comment

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

just a sidebar, is this actually faster thankeys1[keys1.length] = key;? (i may have asked this before)

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I believe it is the same, while that method is also used before and it is more about the overall logic that should have an impact (less checks for being enumerable needed and no filtering).

ljharb reacted with thumbs up emoji
getEnumerables(val2,symbolKeysB).length!==0){
returnfalse;
}
for(constkeyofgetOwnSymbols(val2)){
Copy link
Member

Choose a reason for hiding this comment

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

this should probably be a normal for loop (or use SafeArrayIterator)

aduh95 reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This is the same as before and I don't think we should write more non-idiomatic code than absolutely required.

Copy link
Member

Choose a reason for hiding this comment

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

a normal for loop is quite idiomatic, but sure, if the perf here isn't important then that's fine

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ljharbljharbljharb left review comments

@aduh95aduh95aduh95 left review comments

@anonriganonriganonrig approved these changes

@cjihrigcjihrigcjihrig approved these changes

Assignees

No one assigned

Labels

assertIssues and PRs related to the assert subsystem.needs-ciPRs that need a full CI run.request-ciAdd this label to start a Jenkins CI on a PR.utilIssues and PRs related to the built-in util module.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@BridgeAR@ljharb@anonrig@cjihrig@aduh95@nodejs-github-bot

[8]ページ先頭

©2009-2025 Movatter.jp