Uh oh!
There was an error while loading. Please reload this page.
assert,util: improve deep object comparison performance - #57648
assert,util: improve deep object comparison performance#57648nodejs-github-bot merged 5 commits into
Conversation
nodejs-github-bot
commented
Mar 27, 2025
Review requested:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
717c5ac to
c9b2d34CompareCodecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@## main #57648 +/- ##
==========================================
+ Coverage 90.24% 90.27% +0.02%
==========================================
Files 630 630 Lines 184990 185129 +139 Branches 36216 36259 +43 ==========================================
+ Hits 166948 167116 +168 + Misses 11003 10984 -19 + Partials 7039 7029 -10
🚀 New features to boost your workflow:
|
Failed to start CI⚠ Commits were pushed since the last approving review: ⚠ - assert,util: improve deep object comparison performance ⚠ - assert,util: improve deep equal comparison performance ⚠ - assert,util: improve (partial) deep equal comparison performance ⚠ - test: add assert.deepStrictEqual test cases to cover more cases ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/14264748421 |
bengl
left a comment
There was a problem hiding this comment.
Broadly speaking, a lot of these optimizations are very non-obvious, and could use some commentary. That said, the reasons why become clearer on multiple reads, so I'm not going to block on that.
The one about getting the descriptor instead of using ObjectPropertyIsEnumerable still stands though.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This improves the performance for almost all objects when comparing them deeply.
This allows the compiler to inline parts of the code in a way that especially primitives in arrays can be compared faster.
The circular check is now done lazily. That way only users that actually make use of such structures have to do the calculation overhead. It is an initial overhead the very first time it's run to detect the circular structure, while every following call uses the check for circular structures by default. This improves the performance for object comparison significantly. On top of that, this includes an optimised algorithm for sets and maps that contain objects as keys. The tracking is now done in an array and the array size is not changed when elements at the start or at the end of the array is detected. The order of the elements matter, so a reversed key order is now a magnitude faster. Insert sort comparison is also signficantly faster, random order is a tad faster.
Uh oh!
There was an error while loading. Please reload this page.
ccea4ca to
75d8fbbComparenodejs-github-bot
commented
Apr 4, 2025
nodejs-github-bot
commented
Apr 4, 2025
nodejs-github-bot
commented
Apr 5, 2025
Landed in e739559 |
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing them deeply. PR-URL: #57648 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This improves the performance for almost all objects when comparing
them deeply significantly.