Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Pechkurov <apechkurov@gmail.com>2020-07-25 20:37:30 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2020-07-29 18:20:59 +0300
commitdd2988917f5ccf55891708fdb8a3cb85a76af0ab (patch)
treed0b6def36292cc1e8196e7976afffba8c48ed236 /benchmark
parente5f380052f9899e527ad5a501c3e55d3edc24ce4 (diff)
async_hooks: optimize fast-path promise hook for ALS
Remove unnecessary native-to-JS code switches in fast-path for PromiseHooks. Those switches happen even if a certain type of hook (say, before) is not installed, which may lead to sub-optimal performance in the AsyncLocalStorage scenario, i.e. when there is only an init hook. PR-URL: https://github.com/nodejs/node/pull/34512 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/async_hooks/promises.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/benchmark/async_hooks/promises.js b/benchmark/async_hooks/promises.js
index 5632a6901d6..9927ec0dc50 100644
--- a/benchmark/async_hooks/promises.js
+++ b/benchmark/async_hooks/promises.js
@@ -19,6 +19,11 @@ const tests = {
promiseResolve() {},
destroy() {}
}).enable();
+ },
+ enabledWithInitOnly() {
+ hook = createHook({
+ init() {}
+ }).enable();
}
};
@@ -27,6 +32,7 @@ const bench = common.createBenchmark(main, {
asyncHooks: [
'enabled',
'enabledWithDestroy',
+ 'enabledWithInitOnly',
'disabled',
]
});