-
Notifications
You must be signed in to change notification settings - Fork 30.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
assert: improve myers diff performance
fix: #57242 PR-URL: #57279 Fixes: #57242 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: LiviaMedeiros <[email protected]>
- Loading branch information
Showing
2 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
'use strict'; | ||
const common = require('../common.js'); | ||
const assert = require('assert'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
n: [10, 50, 200, 500], | ||
size: [10, 100], | ||
datasetName: ['objects'], | ||
}); | ||
|
||
const baseObject = { | ||
a: 1, | ||
b: { | ||
c: 2, | ||
d: [3, 4, 5], | ||
e: 'fghi', | ||
j: { | ||
k: 6, | ||
}, | ||
}, | ||
}; | ||
|
||
function createObjects(size) { | ||
return Array.from({ length: size }, () => baseObject); | ||
} | ||
|
||
function main({ n, size }) { | ||
bench.start(); | ||
for (let i = 0; i < n; ++i) { | ||
new assert.AssertionError({ | ||
actual: {}, | ||
expected: createObjects(size), | ||
operator: 'partialDeepStrictEqual', | ||
stackStartFunction: () => {}, | ||
}); | ||
} | ||
bench.end(n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters