Skip to content

Commit 7a8461a

Browse files
committed
benchmark: exercise test runner hook bodies
Update the hooks benchmark so registered hooks perform the same anti-optimization assignment as test bodies instead of calling a noop. This keeps the measured hook path from using an empty callback. Links for more information on this actions: nodejs#48931 (comment) https://www.mail-archive.com/v8-users@googlegroups.com/msg05521.html Signed-off-by: Luan Muniz <luan@luanmuniz.com.br>
1 parent b9188c0 commit 7a8461a

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

benchmark/test_runner/hooks.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ const bench = common.createBenchmark(main, {
2020
flags: ['--test-reporter=./benchmark/fixtures/empty-test-reporter.js'],
2121
});
2222

23-
const noop = () => {};
24-
2523
const hookList = {
2624
before: before,
2725
after: after,
@@ -32,7 +30,9 @@ const hookList = {
3230
function run(loopAmount, avoidV8Optimization, hookFn) {
3331
for (let i = 0; i < loopAmount; i++) {
3432
describe(`${i}`, () => {
35-
hookFn(noop);
33+
hookFn(() => {
34+
avoidV8Optimization = i;
35+
});
3636

3737
it(`${i}`, () => {
3838
avoidV8Optimization = i;

0 commit comments

Comments
 (0)