From 2c8c9f978df2838acd2334d6beca1818cec67e15 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 1 Feb 2023 22:46:09 +0100 Subject: [PATCH] benchmark: add trailing commas in `benchmark/async_hooks` PR-URL: https://github.com/nodejs/node/pull/46424 Reviewed-By: Moshe Atlow Reviewed-By: James M Snell Reviewed-By: Chengzhong Wu --- benchmark/.eslintrc.yaml | 1 - benchmark/async_hooks/async-local-storage-run.js | 2 +- .../async_hooks/async-resource-vs-destroy.js | 16 ++++++++-------- benchmark/async_hooks/gc-tracking.js | 4 ++-- benchmark/async_hooks/http-server.js | 8 ++++---- benchmark/async_hooks/promises.js | 12 ++++++------ 6 files changed, 21 insertions(+), 22 deletions(-) diff --git a/benchmark/.eslintrc.yaml b/benchmark/.eslintrc.yaml index 4b88c8eedadd1e..49c1da33358328 100644 --- a/benchmark/.eslintrc.yaml +++ b/benchmark/.eslintrc.yaml @@ -9,7 +9,6 @@ rules: overrides: - files: - - async_hooks/*.js - buffers/*.js - buffers-fill/*.js - crypto/*.js diff --git a/benchmark/async_hooks/async-local-storage-run.js b/benchmark/async_hooks/async-local-storage-run.js index d65abb7047b2e4..db2a44904f5d13 100644 --- a/benchmark/async_hooks/async-local-storage-run.js +++ b/benchmark/async_hooks/async-local-storage-run.js @@ -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) { diff --git a/benchmark/async_hooks/async-resource-vs-destroy.js b/benchmark/async_hooks/async-resource-vs-destroy.js index 09898bbe52f939..3bd9dd56934e32 100644 --- a/benchmark/async_hooks/async-resource-vs-destroy.js +++ b/benchmark/async_hooks/async-resource-vs-destroy.js @@ -9,7 +9,7 @@ const { createHook, executionAsyncResource, executionAsyncId, - AsyncLocalStorage + AsyncLocalStorage, } = require('async_hooks'); const { createServer } = require('http'); @@ -19,7 +19,7 @@ const bench = common.createBenchmark(main, { path: '/', connections: 500, duration: 5, - n: [1e6] + n: [1e6], }); function buildCurrentResource(getServe) { @@ -30,7 +30,7 @@ function buildCurrentResource(getServe) { return { server, - close + close, }; function getCLS() { @@ -71,7 +71,7 @@ function buildDestroy(getServe) { return { server, - close + close, }; function getCLS() { @@ -108,7 +108,7 @@ function buildAsyncLocalStorage(getServe) { return { server, - close + close, }; function getCLS() { @@ -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 }) { @@ -178,7 +178,7 @@ function main({ type, asyncMethod, connections, duration, path }) { bench.http({ path, connections, - duration + duration, }, () => { close(); }); diff --git a/benchmark/async_hooks/gc-tracking.js b/benchmark/async_hooks/gc-tracking.js index 4a59a5a4b655c5..2b0a74ddac76d9 100644 --- a/benchmark/async_hooks/gc-tracking.js +++ b/benchmark/async_hooks/gc-tracking.js @@ -8,9 +8,9 @@ const bench = common.createBenchmark(main, { 'trackingEnabled', 'trackingEnabledWithDestroyHook', 'trackingDisabled', - ] + ], }, { - flags: ['--expose-gc'] + flags: ['--expose-gc'], }); function endAfterGC(n) { diff --git a/benchmark/async_hooks/http-server.js b/benchmark/async_hooks/http-server.js index c8e44849b7466f..da5f86f0e50601 100644 --- a/benchmark/async_hooks/http-server.js +++ b/benchmark/async_hooks/http-server.js @@ -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 }) { @@ -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); @@ -34,7 +34,7 @@ function main({ asyncHooks, connections, duration }) { bench.http({ connections, path, - duration + duration, }, () => { server.close(); }); diff --git a/benchmark/async_hooks/promises.js b/benchmark/async_hooks/promises.js index d60ae70192c8cb..f533d63f2a3135 100644 --- a/benchmark/async_hooks/promises.js +++ b/benchmark/async_hooks/promises.js @@ -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, { @@ -34,7 +34,7 @@ const bench = common.createBenchmark(main, { 'enabledWithDestroy', 'enabledWithInitOnly', 'disabled', - ] + ], }); const err = new Error('foobar');