Skip to content

Commit f006b2f

Browse files
aduh95danielleadams
authored andcommitted
benchmark: add trailing commas in benchmark/async_hooks
PR-URL: #46424 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 534562f commit f006b2f

6 files changed

+21
-22
lines changed

benchmark/.eslintrc.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ rules:
99

1010
overrides:
1111
- files:
12-
- async_hooks/*.js
1312
- buffers/*.js
1413
- buffers-fill/*.js
1514
- crypto/*.js

benchmark/async_hooks/async-local-storage-run.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common.js');
33
const { AsyncLocalStorage } = require('async_hooks');
44

55
const bench = common.createBenchmark(main, {
6-
n: [1e7]
6+
n: [1e7],
77
});
88

99
async function run(store, n) {

benchmark/async_hooks/async-resource-vs-destroy.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {
99
createHook,
1010
executionAsyncResource,
1111
executionAsyncId,
12-
AsyncLocalStorage
12+
AsyncLocalStorage,
1313
} = require('async_hooks');
1414
const { createServer } = require('http');
1515

@@ -19,7 +19,7 @@ const bench = common.createBenchmark(main, {
1919
path: '/',
2020
connections: 500,
2121
duration: 5,
22-
n: [1e6]
22+
n: [1e6],
2323
});
2424

2525
function buildCurrentResource(getServe) {
@@ -30,7 +30,7 @@ function buildCurrentResource(getServe) {
3030

3131
return {
3232
server,
33-
close
33+
close,
3434
};
3535

3636
function getCLS() {
@@ -71,7 +71,7 @@ function buildDestroy(getServe) {
7171

7272
return {
7373
server,
74-
close
74+
close,
7575
};
7676

7777
function getCLS() {
@@ -108,7 +108,7 @@ function buildAsyncLocalStorage(getServe) {
108108

109109
return {
110110
server,
111-
close
111+
close,
112112
};
113113

114114
function getCLS() {
@@ -160,12 +160,12 @@ function getServeCallbacks(getCLS, setCLS) {
160160
const types = {
161161
'async-resource': buildCurrentResource,
162162
'destroy': buildDestroy,
163-
'async-local-storage': buildAsyncLocalStorage
163+
'async-local-storage': buildAsyncLocalStorage,
164164
};
165165

166166
const asyncMethods = {
167167
'callbacks': getServeCallbacks,
168-
'async': getServeAwait
168+
'async': getServeAwait,
169169
};
170170

171171
function main({ type, asyncMethod, connections, duration, path }) {
@@ -178,7 +178,7 @@ function main({ type, asyncMethod, connections, duration, path }) {
178178
bench.http({
179179
path,
180180
connections,
181-
duration
181+
duration,
182182
}, () => {
183183
close();
184184
});

benchmark/async_hooks/gc-tracking.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const bench = common.createBenchmark(main, {
88
'trackingEnabled',
99
'trackingEnabledWithDestroyHook',
1010
'trackingDisabled',
11-
]
11+
],
1212
}, {
13-
flags: ['--expose-gc']
13+
flags: ['--expose-gc'],
1414
});
1515

1616
function endAfterGC(n) {

benchmark/async_hooks/http-server.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
asyncHooks: ['init', 'before', 'after', 'all', 'disabled', 'none'],
66
connections: [50, 500],
7-
duration: 5
7+
duration: 5,
88
});
99

1010
function main({ asyncHooks, connections, duration }) {
@@ -14,11 +14,11 @@ function main({ asyncHooks, connections, duration }) {
1414
before() {},
1515
after() {},
1616
destroy() {},
17-
promiseResolve() {}
17+
promiseResolve() {},
1818
};
1919
if (asyncHooks !== 'all' || asyncHooks !== 'disabled') {
2020
hooks = {
21-
[asyncHooks]: () => {}
21+
[asyncHooks]: () => {},
2222
};
2323
}
2424
const hook = require('async_hooks').createHook(hooks);
@@ -34,7 +34,7 @@ function main({ asyncHooks, connections, duration }) {
3434
bench.http({
3535
connections,
3636
path,
37-
duration
37+
duration,
3838
}, () => {
3939
server.close();
4040
});

benchmark/async_hooks/promises.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ let hook;
66
const tests = {
77
disabled() {
88
hook = createHook({
9-
promiseResolve() {}
9+
promiseResolve() {},
1010
});
1111
},
1212
enabled() {
1313
hook = createHook({
14-
promiseResolve() {}
14+
promiseResolve() {},
1515
}).enable();
1616
},
1717
enabledWithDestroy() {
1818
hook = createHook({
1919
promiseResolve() {},
20-
destroy() {}
20+
destroy() {},
2121
}).enable();
2222
},
2323
enabledWithInitOnly() {
2424
hook = createHook({
25-
init() {}
25+
init() {},
2626
}).enable();
27-
}
27+
},
2828
};
2929

3030
const bench = common.createBenchmark(main, {
@@ -34,7 +34,7 @@ const bench = common.createBenchmark(main, {
3434
'enabledWithDestroy',
3535
'enabledWithInitOnly',
3636
'disabled',
37-
]
37+
],
3838
});
3939

4040
const err = new Error('foobar');

0 commit comments

Comments
 (0)