Skip to content

Experimental Workload: Intl#146

Merged
camillobruni merged 13 commits into
WebKit:mainfrom
camillobruni:2025-08-18_data_formatting
Sep 11, 2025
Merged

Experimental Workload: Intl#146
camillobruni merged 13 commits into
WebKit:mainfrom
camillobruni:2025-08-18_data_formatting

Conversation

@camillobruni
Copy link
Copy Markdown
Contributor

This could potentially replace the old datetime formatting workloads.
The workload stress tests the following Intl APIs:

  • DateTimeFormat
  • ListFormat
  • RelativeTimeFormat
  • NumberFormat
  • PluralRules

I've gone with a fairly random choice of locals before spending more time on getting a more representative list.

@camillobruni camillobruni requested a review from kmiller68 August 18, 2025 10:10
@netlify
Copy link
Copy Markdown

netlify Bot commented Aug 18, 2025

Deploy Preview for webkit-jetstream-preview ready!

Name Link
🔨 Latest commit 5f60932
🔍 Latest deploy log https://app.netlify.com/projects/webkit-jetstream-preview/deploys/68b6bf25ee22f000081ac52c
😎 Deploy Preview https://deploy-preview-146--webkit-jetstream-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@camillobruni
Copy link
Copy Markdown
Contributor Author

@iainireland this might be interesting too for mozilla, seems like your implementation is fairly efficient: spidermonkey > jsc > v8

Comment thread intl/benchmark.js Outdated
@camillobruni
Copy link
Copy Markdown
Contributor Author

Looks like we get slightly different results perf platform :/. Looking into it.

@camillobruni
Copy link
Copy Markdown
Contributor Author

camillobruni commented Aug 26, 2025

We might have to skip Intl.RelativeTimeFormat due to interop issues, SpiderMonkey and V8 agree, but JSC does have some different values.

Examples:

  • missing spaces:
Screenshot 2025-08-26 at 23 13 43
  • Spanish: en vs dentro de)
Screenshot 2025-08-26 at 23 14 44
  • There are further issues, now with v8, for some units it changes the decimal point:
Screenshot 2025-08-26 at 23 21 54

@Constellation
Copy link
Copy Markdown
Member

Constellation commented Aug 28, 2025

I have a concern about this benchmark since it ends up just measuring ICU performance. ICU version and Intl format is arbitrary, and the output / behavior / customization is not standardized by the spec (ECMA-402 offers significant amount of freedom to the implementation). So it does not become apple-to-apple comparison.

If the input => output is defined by ECMA-402, and offering the freedom on how to implement these conversion, I think adding them as a benchmark makes sense. However, ECMA-402 does not specify what output we will get, so measuring these performance on each engine ends up measuring completely different workload under the same name.

For example, it is possible that we can make the code faster by stripping all of locales and just having en_US. But I don't think that's the direction JetStream should encourage. Also each platform tends to customize (even adding some special code in some cases) ICU to offer their platform-consistent behavior, so each one is doing different things and generating different outputs.

Apple ICU is heavily modified to make the i18n results consistent to Apple HIG and the rest of the platform. Google Chrome's bundled ICU is customizing locale's behavior (e.g. using latin numbers for ar_AE). Firefox ICU is stripping many locales to reduce the payload size. So customizations and behavior difference is already real. I don't think comparing the performance without caring the output difference makes sense.

@camillobruni
Copy link
Copy Markdown
Contributor Author

Thanks for the insights. I think that's fair to not include this in the final score then if the behavior is not specced properly.

I'd like to keep this as non-default workload for now then, I think this is still going to be interesting for engineers to optimise this in a realistic scenario.

Independent of this, I'm now curious if there are any plans to improve the interop situation here long-term? In my naive understanding I would expect that most JS APIs work consistently across platforms.

@camillobruni camillobruni changed the title New Workload: Intl Experimental Workload: Intl Sep 1, 2025
@kmiller68
Copy link
Copy Markdown
Contributor

Overall LGTM.

Independent of this, I'm now curious if there are any plans to improve the interop situation here long-term? In my naive understanding I would expect that most JS APIs work consistently across platforms.

I think TC-39 intentionally left this up to implementations. IIRC, one specific case was for embedded devices where there may not be enough disk space to hold every locale. Also, since most engines/TC-39 don't own ICU the exact localization is implementation defined.

@camillobruni
Copy link
Copy Markdown
Contributor Author

Ok, then let's definitely keep this disabled. Not sure – should there ever be a fixed agreement on a set of locales we could reconsider this.

Copy link
Copy Markdown
Contributor

@kmiller68 kmiller68 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on some internal discussion maybe we should add an Intl.Segmenter test too. We can file an issue for that later though.

@camillobruni
Copy link
Copy Markdown
Contributor Author

SG, filed #181 to keep track of this.

@camillobruni camillobruni merged commit ad6b578 into WebKit:main Sep 11, 2025
9 of 10 checks passed
@camillobruni camillobruni deleted the 2025-08-18_data_formatting branch September 11, 2025 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants