mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
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>
This commit is contained in:
1 parent
6fd09e4f36
commit
53870ddeac
2 files changed
+65
-7
No files matched your search
@@ -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',
|
||||
]
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user