mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 04:52:06 +02:00
LibJS: Cache rejected/fulfilled callbacks in AsyncFunctionDriverWrapper
Saves us two NativeFunction allocations per each `await`.
With this change, following function goes 80% faster on my computer:
```js
(async () => {
const resolved = Promise.resolve();
for (let i = 0; i < 5_000_000; i++) {
await resolved;
}
})();
```
This commit is contained in:
committed by
Andreas Kling
parent
4c789ac689
commit
6530f55f34
Notes:
github-actions[bot]
2025-05-09 10:31:10 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/6530f55f34e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4663
@@ -34,6 +34,9 @@ private:
|
||||
GC::Ref<Promise> m_top_level_promise;
|
||||
GC::Ptr<Promise> m_current_promise { nullptr };
|
||||
OwnPtr<ExecutionContext> m_suspended_execution_context;
|
||||
|
||||
GC::Ptr<NativeFunction> m_on_fulfilled;
|
||||
GC::Ptr<NativeFunction> m_on_rejected;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user