Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: add trailing commas in benchmark/async_hooks #46424

Merged
merged 1 commit into from Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmark/.eslintrc.yaml
Expand Up @@ -9,7 +9,6 @@ rules:

overrides:
- files:
- async_hooks/*.js
- buffers/*.js
- buffers-fill/*.js
- crypto/*.js
Expand Down
2 changes: 1 addition & 1 deletion benchmark/async_hooks/async-local-storage-run.js
Expand Up @@ -3,7 +3,7 @@ const common = require('../common.js');
const { AsyncLocalStorage } = require('async_hooks');

const bench = common.createBenchmark(main, {
n: [1e7]
n: [1e7],
});

async function run(store, n) {
Expand Down
16 changes: 8 additions & 8 deletions benchmark/async_hooks/async-resource-vs-destroy.js
Expand Up @@ -9,7 +9,7 @@ const {
createHook,
executionAsyncResource,
executionAsyncId,
AsyncLocalStorage
AsyncLocalStorage,
} = require('async_hooks');
const { createServer } = require('http');

Expand All @@ -19,7 +19,7 @@ const bench = common.createBenchmark(main, {
path: '/',
connections: 500,
duration: 5,
n: [1e6]
n: [1e6],
});

function buildCurrentResource(getServe) {
Expand All @@ -30,7 +30,7 @@ function buildCurrentResource(getServe) {

return {
server,
close
close,
};

function getCLS() {
Expand Down Expand Up @@ -71,7 +71,7 @@ function buildDestroy(getServe) {

return {
server,
close
close,
};

function getCLS() {
Expand Down Expand Up @@ -108,7 +108,7 @@ function buildAsyncLocalStorage(getServe) {

return {
server,
close
close,
};

function getCLS() {
Expand Down Expand Up @@ -160,12 +160,12 @@ function getServeCallbacks(getCLS, setCLS) {
const types = {
'async-resource': buildCurrentResource,
'destroy': buildDestroy,
'async-local-storage': buildAsyncLocalStorage
'async-local-storage': buildAsyncLocalStorage,
};

const asyncMethods = {
'callbacks': getServeCallbacks,
'async': getServeAwait
'async': getServeAwait,
};

function main({ type, asyncMethod, connections, duration, path }) {
Expand All @@ -178,7 +178,7 @@ function main({ type, asyncMethod, connections, duration, path }) {
bench.http({
path,
connections,
duration
duration,
}, () => {
close();
});
Expand Down
4 changes: 2 additions & 2 deletions benchmark/async_hooks/gc-tracking.js
Expand Up @@ -8,9 +8,9 @@ const bench = common.createBenchmark(main, {
'trackingEnabled',
'trackingEnabledWithDestroyHook',
'trackingDisabled',
]
],
}, {
flags: ['--expose-gc']
flags: ['--expose-gc'],
});

function endAfterGC(n) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/async_hooks/http-server.js
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
asyncHooks: ['init', 'before', 'after', 'all', 'disabled', 'none'],
connections: [50, 500],
duration: 5
duration: 5,
});

function main({ asyncHooks, connections, duration }) {
Expand All @@ -14,11 +14,11 @@ function main({ asyncHooks, connections, duration }) {
before() {},
after() {},
destroy() {},
promiseResolve() {}
promiseResolve() {},
};
if (asyncHooks !== 'all' || asyncHooks !== 'disabled') {
hooks = {
[asyncHooks]: () => {}
[asyncHooks]: () => {},
};
}
const hook = require('async_hooks').createHook(hooks);
Expand All @@ -34,7 +34,7 @@ function main({ asyncHooks, connections, duration }) {
bench.http({
connections,
path,
duration
duration,
}, () => {
server.close();
});
Expand Down
12 changes: 6 additions & 6 deletions benchmark/async_hooks/promises.js
Expand Up @@ -6,25 +6,25 @@ let hook;
const tests = {
disabled() {
hook = createHook({
promiseResolve() {}
promiseResolve() {},
});
},
enabled() {
hook = createHook({
promiseResolve() {}
promiseResolve() {},
}).enable();
},
enabledWithDestroy() {
hook = createHook({
promiseResolve() {},
destroy() {}
destroy() {},
}).enable();
},
enabledWithInitOnly() {
hook = createHook({
init() {}
init() {},
}).enable();
}
},
};

const bench = common.createBenchmark(main, {
Expand All @@ -34,7 +34,7 @@ const bench = common.createBenchmark(main, {
'enabledWithDestroy',
'enabledWithInitOnly',
'disabled',
]
],
});

const err = new Error('foobar');
Expand Down