Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 21bc1e34f9398ac93d49cb9118f022f801275684
      
https://github.com/WebKit/WebKit/commit/21bc1e34f9398ac93d49cb9118f022f801275684
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-02-13 (Fri, 13 Feb 2026)

  Changed paths:
    A JSTests/microbenchmarks/intl-relative-time-format-to-parts-auto.js
    A JSTests/microbenchmarks/intl-relative-time-format-to-parts.js
    M Source/JavaScriptCore/runtime/IntlNumberFormat.cpp
    M Source/JavaScriptCore/runtime/IntlNumberFormatInlines.h
    M Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.cpp
    M Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.h

  Log Message:
  -----------
  [JSC] Use `UFormattedValue` API in `IntlRelativeTimeFormat::formatToParts`
https://bugs.webkit.org/show_bug.cgi?id=307623

Reviewed by Yusuke Suzuki.

Use ureldatefmt_formatNumericToResult / ureldatefmt_formatToResult to
obtain both the formatted string and field position metadata in a single
ICU call.

Read UFIELD_CATEGORY_NUMBER fields directly from the UFormattedValue to
build number sub-parts, eliminating the separate unum_formatDoubleForFields
call and String::find lookup.

Pre-allocate UFormattedRelativeDateTime and UConstrainedFieldPosition
during initialization and reuse them across calls.

Extend IntlFieldIterator to support construction from a Vector of
pre-collected fields, so number fields from UFormattedValue can be
passed to IntlNumberFormat::formatToPartsInternal.

                                                 TipOfTree                  
Patched

intl-relative-time-format-to-parts-auto       14.3070+-0.6379     ^      
6.7217+-0.3445        ^ definitely 2.1285x faster
intl-relative-time-format-to-parts            30.4560+-0.2629     ^     
26.3840+-0.0927        ^ definitely 1.1543x faster

* JSTests/microbenchmarks/intl-relative-time-format-to-parts-auto.js: Added.
(test):
* JSTests/microbenchmarks/intl-relative-time-format-to-parts.js: Added.
(test):
* Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:
* Source/JavaScriptCore/runtime/IntlNumberFormatInlines.h:
(JSC::IntlFieldIterator::IntlFieldIterator):
(JSC::IntlFieldIterator::next):
* Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.cpp:
(JSC::IntlRelativeTimeFormat::initializeRelativeTimeFormat):
(JSC::IntlRelativeTimeFormat::formatInternal const):
(JSC::IntlRelativeTimeFormat::formatToParts const):
* Source/JavaScriptCore/runtime/IntlRelativeTimeFormat.h:

Canonical link: https://commits.webkit.org/307449@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to