Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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-bot nodejs-github-bot added assert Issues and PRs related to the assert subsystem. needs-ci PRs that need a full CI run. util Issues and PRs related to the built-in util module. labels Dec 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
Member Author

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.

Copy link
Member Author

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 starting
to handle invalid dates as being equal.
This is a very small improvement for error creation.
@BridgeAR BridgeAR force-pushed the BridgeAR/2025-12-14-improve-assert-perf branch from 4f7303b to 641e674 Compare December 15, 2025 22:50
@codecov
Copy link

codecov bot commented Dec 16, 2025

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 lines Coverage Δ
lib/internal/assert/assertion_error.js 95.97% <100.00%> (+0.03%) ⬆️
lib/internal/util/comparisons.js 99.70% <100.00%> (-0.30%) ⬇️

... and 39 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.

@BridgeAR BridgeAR added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 16, 2025
return false;
for (const key of getOwnSymbols(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 than keys1[keys1.length] = key;? (i may have asked this before)

Copy link
Member Author

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).

getEnumerables(val2, symbolKeysB).length !== 0) {
return false;
}
for (const key of getOwnSymbols(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)

Copy link
Member Author

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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assert Issues and PRs related to the assert subsystem. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. util Issues and PRs related to the built-in util module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants