Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4ed24b821a126ef9290f356535e9b6b0ce06208f
https://github.com/WebKit/WebKit/commit/4ed24b821a126ef9290f356535e9b6b0ce06208f
Author: Sosuke Suzuki <[email protected]>
Date: 2026-05-20 (Wed, 20 May 2026)
Changed paths:
A JSTests/microbenchmarks/promise-all-non-thenable-object.js
A JSTests/microbenchmarks/promise-all-non-thenable.js
A JSTests/microbenchmarks/promise-all-settled-non-thenable.js
A JSTests/microbenchmarks/promise-race-non-thenable.js
A JSTests/stress/promise-combinator-non-thenable-element.js
M Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
Log Message:
-----------
[JSC] Skip intermediate promise allocation for non-thenable elements in
Promise combinators
https://bugs.webkit.org/show_bug.cgi?id=315017
Reviewed by Yusuke Suzuki.
Promise.all / allSettled / any / race call `Promise.resolve(value).then(...)`
for each element.
When `value` is not observably thenable, `Promise.resolve(value)` allocates a
fresh fulfilled
JSPromise that exists only to queue one microtask and is then immediately
garbage. This patch
queues that microtask directly for provably non-thenable elements, saving one
32-byte cell each
without changing any observable ordering or behavior.
Baseline Patched
promise-all-non-thenable 3.9187+-0.1276 ^
2.6620+-0.0957 ^ definitely 1.4721x faster
promise-all-non-thenable-object 4.1062+-0.1207 ^
2.8683+-0.0837 ^ definitely 1.4315x faster
promise-all-settled-non-thenable 4.2607+-0.1511 ^
3.0175+-0.0930 ^ definitely 1.4120x faster
promise-race-non-thenable 2.3936+-0.0667 ^
1.4035+-0.0555 ^ definitely 1.7055x faster
Tests: JSTests/microbenchmarks/promise-all-non-thenable-object.js
JSTests/microbenchmarks/promise-all-non-thenable.js
JSTests/microbenchmarks/promise-all-settled-non-thenable.js
JSTests/microbenchmarks/promise-race-non-thenable.js
JSTests/stress/promise-combinator-non-thenable-element.js
* JSTests/microbenchmarks/promise-all-non-thenable-object.js: Added.
* JSTests/microbenchmarks/promise-all-non-thenable.js: Added.
* JSTests/microbenchmarks/promise-all-settled-non-thenable.js: Added.
* JSTests/microbenchmarks/promise-race-non-thenable.js: Added.
* JSTests/stress/promise-combinator-non-thenable-element.js: Added.
(shouldBe):
(async main.Object.prototype.then):
(async main.Box):
(async main.MyPromise.get Symbol):
(async main.MyPromise):
(async main):
* Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp:
(JSC::isNonThenable):
(JSC::JSC_DEFINE_HOST_FUNCTION):
Canonical link: https://commits.webkit.org/313576@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications