Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date.toLocaleString slowdown since 3.52.2 #1057

Open
msvab opened this issue May 24, 2021 · 5 comments
Open

Date.toLocaleString slowdown since 3.52.2 #1057

msvab opened this issue May 24, 2021 · 5 comments
Labels
library Relates to an Origami library

Comments

@msvab
Copy link

msvab commented May 24, 2021

What

We've noticed that Date.toLocaleString() has great performance degradation on IE11 since version 3.53.2. 3.53.1 is the most recent version which works fine.

Details

Attached is a very basic HTML page which shows the problem. Using version 3.53.1 the benchmark takes 157ms, but on 3.53.2 it takes 6400ms. We use this function to render dates on a datepicker and users with less powerful computers see the "page is not responding due to a long-running script" error.

test.zip

I'm happy to provide more details or if you can point me to the right direction to narrow this issue further?

@origamiserviceuser origamiserviceuser added this to incoming in Origami ✨ May 24, 2021
@github-actions github-actions bot added the library Relates to an Origami library label May 24, 2021
@romainmenke
Copy link
Collaborator

@msvab Could you maybe create a repo with the contents of that zip?
Not really best practice to download and open unknown zips :D

@romainmenke
Copy link
Collaborator

romainmenke commented May 24, 2021

confirmed :

code : https://github.com/romainmenke/intl-performance-issue-1
hosted : https://romainmenke.github.io/intl-performance-issue-1/

This code was run a 100 times in the reproduction

for (var i = 0; i < 100; i++) {
	var event = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
	event.toLocaleString('es', { timeZone: 'UTC' });
}

Screenshot 2021-05-24 at 18 44 20


@longlho Can you take a look?

@longlho
Copy link
Contributor

longlho commented May 26, 2021

hmm what about latest version? Those are super old versions that don't use @formatjs/intl-datetimeformat so I don't have much control over it

@msvab
Copy link
Author

msvab commented May 26, 2021

hmm what about latest version? Those are super old versions that don't use @formatjs/intl-datetimeformat so I don't have much control over it

@longlho The latest version 3.104.0 is actually the one where we discovered the slowdown. Then we went back to identify which was the last version with acceptable speed.

@romainmenke
Copy link
Collaborator

romainmenke commented May 26, 2021

https://github.com/Financial-Times/polyfill-library/compare/v3.53.2..v3.53.1

Maybe it's not a change in an Intl polyfill, but something in a dependency, or the build output?

To me this is starting to look like 3.53.2 fixed the build process which caused all needed polyfills to be loaded.
3.53.1 is most likely faster because it is not really working.


polyfill list from 3.53.1

 * Features requested: Intl.DateTimeFormat,Intl.DateTimeFormat.~locale.es,Intl.NumberFormat.~locale.es,Intl.PluralRules.~locale.es
 * 
 * - Intl, License: MIT (required by "Intl.PluralRules.~locale.es", "Intl.PluralRules")
 * - Intl.PluralRules, License: MIT (required by "Intl.PluralRules.~locale.es")
 * - Intl.PluralRules.~locale.es, License: MIT */

polyfill list from 3.53.2

 * Features requested: Intl.DateTimeFormat,Intl.DateTimeFormat.~locale.es,Intl.NumberFormat.~locale.es,Intl.PluralRules.~locale.es
 * 
 * - _ESAbstract.Call, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor", "_ESAbstract.ToPropertyKey", "_ESAbstract.ToPrimitive", "_ESAbstract.OrdinaryToPrimitive")
 * - _ESAbstract.CreateDataProperty, License: CC0 (required by "Intl.PluralRules.~locale.es", "Intl.Locale", "Set", "_ESAbstract.CreateIterResultObject")
 * - _ESAbstract.CreateMethodProperty, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.includes")
 * - _ESAbstract.Get, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor", "_ESAbstract.ToPropertyKey", "_ESAbstract.ToPrimitive", "_ESAbstract.OrdinaryToPrimitive")
 * - _ESAbstract.HasOwnProperty, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor")
 * - _ESAbstract.IsArray, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - _ESAbstract.IsCallable, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor", "_ESAbstract.ToPropertyKey", "_ESAbstract.ToPrimitive", "_ESAbstract.OrdinaryToPrimitive")
 * - _ESAbstract.SameValueNonNumber, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.SameValue")
 * - _ESAbstract.ToBoolean, License: CC0 (required by "Intl.PluralRules.~locale.es", "Intl.Locale", "Set", "_ESAbstract.IteratorComplete")
 * - _ESAbstract.ToObject, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.GetIterator", "_ESAbstract.GetV")
 * - _ESAbstract.GetV, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.GetIterator")
 * - _ESAbstract.GetMethod, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor", "_ESAbstract.ToPropertyKey", "_ESAbstract.ToPrimitive")
 * - _ESAbstract.Type, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor", "_ESAbstract.ToPropertyKey", "_ESAbstract.ToPrimitive", "_ESAbstract.OrdinaryToPrimitive")
 * - _ESAbstract.CreateIterResultObject, License: CC0 (required by "Intl.PluralRules.~locale.es", "Intl.Locale", "Set")
 * - _ESAbstract.GetPrototypeFromConstructor, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.OrdinaryCreateFromConstructor")
 * - _ESAbstract.OrdinaryCreateFromConstructor, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - _ESAbstract.IteratorClose, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - _ESAbstract.IteratorComplete, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.IteratorStep")
 * - _ESAbstract.IteratorNext, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.IteratorStep")
 * - _ESAbstract.IteratorStep, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - _ESAbstract.IteratorValue, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - _ESAbstract.OrdinaryToPrimitive, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor", "_ESAbstract.ToPropertyKey", "_ESAbstract.ToPrimitive")
 * - _ESAbstract.SameValue, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - _ESAbstract.SameValueZero, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.includes")
 * - _ESAbstract.ToInteger, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.includes", "_ESAbstract.ToLength")
 * - _ESAbstract.ToLength, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.includes")
 * - _ESAbstract.ToPrimitive, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.includes", "_ESAbstract.ToString")
 * - _ESAbstract.ToString, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames", "Array.prototype.includes")
 * - _ESAbstract.ToPropertyKey, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyDescriptor")
 * - Array.prototype.includes, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Object.setPrototypeOf", "Object.getOwnPropertyNames")
 * - Array.prototype.sort, License: MIT (required by "Intl.PluralRules.~locale.es", "Intl.Locale")
 * - Object.getOwnPropertyDescriptor, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "Symbol")
 * - Object.keys, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "Symbol")
 * - Object.assign, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Intl.PluralRules")
 * - Intl.getCanonicalLocales, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Intl.PluralRules")
 * - Object.getOwnPropertyNames, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "Symbol")
 * - Object.setPrototypeOf, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Intl.PluralRules")
 * - Symbol, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "Symbol.toStringTag")
 * - Symbol.iterator, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap", "_ESAbstract.GetIterator")
 * - _ESAbstract.GetIterator, License: CC0 (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - Symbol.species, License: MIT (required by "Intl.PluralRules.~locale.es", "Intl.Locale", "Set")
 * - Set, License: CC0 (required by "Intl.PluralRules.~locale.es", "Intl.Locale")
 * - Symbol.toStringTag, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "WeakMap")
 * - WeakMap, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Intl.PluralRules")
 * - Intl.Locale, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat", "Intl.PluralRules")
 * - Intl.PluralRules, License: MIT (required by "Intl.NumberFormat.~locale.es", "Intl.NumberFormat")
 * - Intl.NumberFormat, License: MIT (required by "Intl.NumberFormat.~locale.es")
 * - Intl.DateTimeFormat, License: MIT (required by "Intl.DateTimeFormat.~locale.es")
 * - Intl.DateTimeFormat.~locale.es, License: MIT
 * - Intl.NumberFormat.~locale.es, License: MIT
 * - Intl.PluralRules.~locale.es, License: MIT */

@robertboulton robertboulton removed this from Backlog in Origami ✨ Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library Relates to an Origami library
Projects
None yet
Development

No branches or pull requests

3 participants