Commit 7f85a2c
assert,util: improve deep equal comparison performance
This is mainly a performance improvement for a lot of simple cases.
Diverging elements are detected earlier and equal entries are
partially also detected faster.
A small correctness patch is also included where recursions now
stop as soon as either side has a circular structure. Before, both
sides had to have a circular structure at the specific comparison
which could have caused more checks that likely fail at a later
point.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>
PR-URL: #46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>1 parent abba45e commit 7f85a2cCopy full SHA for 7f85a2c
File tree
Expand file treeCollapse file tree
4 files changed
+175
-132
lines changedOpen diff view settings
Filter options
- benchmark/assert
- doc/api
- lib/internal/util
- test/parallel
Expand file treeCollapse file tree
4 files changed
+175
-132
lines changedOpen diff view settings
Collapse file
benchmark/assert/deepequal-object.js
Copy file name to clipboardExpand all lines: benchmark/assert/deepequal-object.js+2-1Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | | - |
| 15 | + |
| 16 | + |
16 | 17 | |
17 | 18 | |
18 | 19 | |
|
Collapse file
+10-2Lines changed: 10 additions & 2 deletions
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
546 | 546 | |
547 | 547 | |
548 | 548 | |
| 549 | + |
| 550 | + |
| 551 | + |
| 552 | + |
549 | 553 | |
550 | 554 | |
551 | 555 | |
| ||
617 | 621 | |
618 | 622 | |
619 | 623 | |
620 | | - |
| 624 | + |
621 | 625 | |
622 | 626 | |
623 | 627 | |
| ||
727 | 731 | |
728 | 732 | |
729 | 733 | |
| 734 | + |
| 735 | + |
| 736 | + |
| 737 | + |
730 | 738 | |
731 | 739 | |
732 | 740 | |
| ||
780 | 788 | |
781 | 789 | |
782 | 790 | |
783 | | - |
| 791 | + |
784 | 792 | |
785 | 793 | |
786 | 794 | |
|
0 commit comments