diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2023-02-09 22:12:25 +0100 |
---|---|---|
committer | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2023-02-20 15:47:06 +0100 |
commit | 449e9f448937ed1843e4edd61b19590177925ea1 (patch) | |
tree | 32ff2a09db8d7429241a2e99a60b3a15128a82b3 /benchmark | |
parent | a02b434966cd9e4ba1d4ed0d5d70c88c887991cd (diff) | |
download | node-new-449e9f448937ed1843e4edd61b19590177925ea1.tar.gz |
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: https://github.com/nodejs/node/pull/46593
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/assert/deepequal-object.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/benchmark/assert/deepequal-object.js b/benchmark/assert/deepequal-object.js index 80bb50f798..4238129b29 100644 --- a/benchmark/assert/deepequal-object.js +++ b/benchmark/assert/deepequal-object.js @@ -12,7 +12,8 @@ const bench = common.createBenchmark(main, { combinationFilter: (p) => { return p.size === 1e4 && p.n === 25 || p.size === 1e3 && p.n === 2e2 || - p.size === 1e2 && p.n === 2e3; + p.size === 1e2 && p.n === 2e3 || + p.size === 1; }, }); |