Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 145691b

Browse filesBrowse files
committed
benchmark: always throw the same Error instance
Stack trace capturing currently accounts for 40 % of the benchmark running time. Always throwing the same exception object removes that overhead and lets the benchmark be more focused on what it is supposed to measure. Refs: #34512 (comment) PR-URL: #34523 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
1 parent 7886e76 commit 145691b
Copy full SHA for 145691b

File tree

Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-1
lines changed
Open diff view settings
Collapse file

‎benchmark/async_hooks/promises.js‎

Copy file name to clipboardExpand all lines: benchmark/async_hooks/promises.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ const bench = common.createBenchmark(main, {
1010
]
1111
});
1212

13+
const err = new Error('foobar');
1314
async function run(n) {
1415
for (let i = 0; i < n; i++) {
1516
await new Promise((resolve) => resolve())
16-
.then(() => { throw new Error('foobar'); })
17+
.then(() => { throw err; })
1718
.catch((e) => e);
1819
}
1920
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.