Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5da32d944f90991fa11c8a389de754831ac46a90
https://github.com/WebKit/WebKit/commit/5da32d944f90991fa11c8a389de754831ac46a90
Author: Sosuke Suzuki <[email protected]>
Date: 2026-04-25 (Sat, 25 Apr 2026)
Changed paths:
A JSTests/microbenchmarks/intl-constructor-collator.js
A JSTests/microbenchmarks/intl-constructor-datetimeformat.js
A JSTests/microbenchmarks/intl-constructor-durationformat.js
A JSTests/microbenchmarks/intl-constructor-numberformat.js
A JSTests/microbenchmarks/intl-constructor-relativetimeformat.js
M Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
M Source/JavaScriptCore/runtime/IntlDateTimeFormat.h
M Source/JavaScriptCore/runtime/IntlDurationFormat.cpp
M Source/JavaScriptCore/runtime/IntlDurationFormat.h
M Source/JavaScriptCore/runtime/IntlNumberFormat.cpp
M Source/JavaScriptCore/runtime/IntlNumberFormat.h
M Source/JavaScriptCore/runtime/IntlObject.cpp
M Source/JavaScriptCore/runtime/IntlObject.h
M Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.cpp
M Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.h
Log Message:
-----------
[JSC] Lazily resolve default calendar / numberingSystem in Intl constructors
https://bugs.webkit.org/show_bug.cgi?id=313197
Reviewed by Yusuke Suzuki.
resolveLocale() previously always called the localeData() callback for every
relevant extension key, even when neither a -u-<key> Unicode extension nor an
options property requested a specific value. For "ca" and "nu" this performs
expensive ICU lookups (ucal_getKeywordValuesForLocale / unumsys_open) on every
Intl constructor invocation just to obtain the locale-specific default.
This patch skips the localeData() lookup when nothing was requested for the
key, leaving the resolved extension as a null String. Callers omit the
corresponding -u-<key>-<value> when building the ICU locale, and resolve the
actual default lazily in resolvedOptions() via the new defaultCalendarForLocale
/ defaultNumberingSystemForLocale helpers.
A similar optimization was applied to SpiderMonkey:
https://bugzilla.mozilla.org/show_bug.cgi?id=2027765
TipOfTree Patched
intl-constructor-relativetimeformat 89.3730+-0.4593 ^
52.9080+-2.1168 ^ definitely 1.6892x faster
intl-constructor-datetimeformat 222.0054+-6.4766 ^
135.7068+-7.1245 ^ definitely 1.6359x faster
intl-constructor-durationformat 20.1538+-0.1995 ^
8.6587+-0.1319 ^ definitely 2.3276x faster
intl-constructor-numberformat 70.9253+-0.7258 ^
20.8875+-1.0258 ^ definitely 3.3956x faster
intl-constructor-collator 21.4439+-0.7733 ^
13.8002+-0.3970 ^ definitely 1.5539x faster
* JSTests/microbenchmarks/intl-constructor-collator.js: Added.
(test):
* JSTests/microbenchmarks/intl-constructor-datetimeformat.js: Added.
(test):
* JSTests/microbenchmarks/intl-constructor-durationformat.js: Added.
(test):
* JSTests/microbenchmarks/intl-constructor-numberformat.js: Added.
(test):
* JSTests/microbenchmarks/intl-constructor-relativetimeformat.js: Added.
(test):
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::initializeDateTimeFormat):
(JSC::IntlDateTimeFormat::resolvedOptions const):
(JSC::IntlDateTimeFormat::createDateIntervalFormatIfNecessary):
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.h:
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::IntlDurationFormat::initializeDurationFormat):
(JSC::IntlDurationFormat::numberingSystem const):
(JSC::IntlDurationFormat::resolvedOptions const):
* Source/JavaScriptCore/runtime/IntlDurationFormat.h:
* Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::initializeNumberFormat):
(JSC::IntlNumberFormat::resolvedOptions const):
* Source/JavaScriptCore/runtime/IntlNumberFormat.h:
* Source/JavaScriptCore/runtime/IntlObject.cpp:
(JSC::resolveLocale):
(JSC::defaultNumberingSystemForLocale):
(JSC::defaultCalendarForLocale):
* Source/JavaScriptCore/runtime/IntlObject.h:
* Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.cpp:
(JSC::IntlRelativeTimeFormat::initializeRelativeTimeFormat):
(JSC::IntlRelativeTimeFormat::resolvedOptions const):
* Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.h:
Canonical link: https://commits.webkit.org/312029@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications