Uh oh!
There was an error while loading. Please reload this page.
assert: improve partialDeepStrictEqual performance and add benchmark - #56555
assert: improve partialDeepStrictEqual performance and add benchmark#56555puskin wants to merge 1 commit into
Conversation
nodejs-github-bot
commented
Jan 10, 2025
Review requested:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #56555 +/- ##
==========================================
+ Coverage 89.17% 90.23% +1.05%
==========================================
Files 662 630 -32 Lines 191672 184968 -6704 Branches 36884 36192 -692 ==========================================
- Hits 170922 166904 -4018 + Misses 13614 11084 -2530 + Partials 7136 6980 -156
🚀 New features to boost your workflow:
|
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ac146c0 to
762399fComparepuskin
commented
Jan 26, 2025
Is anything else needed here? |
lemire
commented
Jan 26, 2025
@puskin94 Can you share the results of your benchmarking? |
of course 😄 ➜ node git:(partial-deep-strict-equal-perf) ./node --no-warnings benchmark/assert/partial-deep-strict-equal.js assert/partial-deep-strict-equal.js datasetName="objects" size=1000 n=50: 169.87881572367604
assert/partial-deep-strict-equal.js datasetName="sets" size=1000 n=50: 141.24912248982653
assert/partial-deep-strict-equal.js datasetName="maps" size=1000 n=50: 151.36189759383777
assert/partial-deep-strict-equal.js datasetName="arrayBuffers" size=1000 n=50: 14.16071061277997
assert/partial-deep-strict-equal.js datasetName="dataViewArrayBuffers" size=1000 n=50: 16.398050206238278 |
Uh oh!
There was an error while loading. Please reload this page.
762399f to
d061759CompareThere was a problem hiding this comment.
If we're looking for performance, we should probably be using a classic for(;;) loop. I'd recommend rolling back this change (i.e. put back the safeExpected assignment, because it has nothing to do with performance) for this PR, and make a new one switching to a for(;;) loop on which we can run benchmarks
There was a problem hiding this comment.
if you do this tho you would have to call the ArrayFrom primordial. The performance enhancement was to adjust the "low hanging fruit" stuff I could get, "structure" wise, without influencing readability. IMHO the current implementation is better, but happy to change if you don't agree!
reverted the assignment tho
Uh oh!
There was an error while loading. Please reload this page.
d061759 to
f1f220cCompareUh oh!
There was an error while loading. Please reload this page.
f1f220c to
e932899Comparepuskin
commented
Feb 7, 2025
Is anything else needed here? |
puskin
commented
Feb 21, 2025
is any change required here? |
aduh95
commented
Feb 21, 2025
@BridgeAR can you clarify whether you're still blocking? |
nodejs-github-bot
commented
Feb 21, 2025
BridgeAR
left a comment
There was a problem hiding this comment.
Sorry for the late reply. I guess this improves a couple of cases, so that's great! :)
I believe there is more room for improvement by reusing the existing implementation. That could be used for a follow-up PR.
Before landing: could we run the benchmark to see the improvement as percentage? :)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1664/ Results |
e932899 to
a07cf19Comparepuskin
commented
Feb 28, 2025
I must have messed up something with my local codebase. I just pushed again with new performance improvements, this should make some difference |
Uh oh!
There was an error while loading. Please reload this page.
aduh95
commented
Feb 28, 2025
a07cf19 to
b53b85cCompareUh oh!
There was an error while loading. Please reload this page.
b53b85c to
989b529Compareaduh95
commented
Feb 28, 2025
989b529 to
2e4fbdbCompareBridgeAR
commented
Feb 28, 2025
BridgeAR
left a comment
There was a problem hiding this comment.
If I am not mistaken, this mainly improves the performance for sets and maps that have mixed entries (primitives + objects). The current benchmark has no such entry.
I also guess that the primordial usage of the iterator is costly. Could you check if that's the case?
Uh oh!
There was an error while loading. Please reload this page.
2e4fbdb to
4502b76CompareBridgeAR
commented
Mar 5, 2025
Latest benchmark https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1671 Only *** result listed. Looking at the changes and the benchmark outcome, I guess that most work is spend elsewhere. I suggest to land this as is nevertheless. |
aduh95
commented
Mar 13, 2025
This needs a rebase |
BridgeAR
commented
Mar 13, 2025
This was superseded by the other PR |
superseeded by #57370 |
now that #54630 has landed, I took the liberty to review the code I wrote to look for improvements that would squeeze some more performance out of the comparison mechanism
partialDeepStrictEqualRefs: #54630