Number.prototype.toLocaleString is slow
Categories
(Core :: JavaScript: Internationalization API, defect, P2)
Tracking
()
People
(Reporter: jorendorff, Unassigned)
Details
Attachments
(2 files)
Reporter | ||
Comment 1•6 years ago
|
||
Reporter | ||
Comment 2•6 years ago
|
||
Reporter | ||
Comment 3•6 years ago
•
|
||
![]() |
||
Comment 4•6 years ago
|
||
bug 15173540
There's a typo in that bug number, it should be bug 1517354.
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Looks like 77% of this is in js::intl_FormatNumber
unsurprisingly. (And a further 7% in one of the other leaves, not sure why precisely.) Within there,
- 27% in
unum_open
- 19% in
PartitionNumberFormat
and most of that inunum_formatDoubleForFields
- 18% in
js::intl::GetInternalsObject
- 12% in
unum_setAttribute
(!) corresponding toicu::DecimalFormat::setRoundingMode
(wat)
Some portions of overhead in there that we could eliminate for sure. Other bits in there are in ICU. We aren't entirely helped by jumping in and out of self-hosted code frequently, it appears, perhaps as a general concern.
A fair number of things that could be investigated here, for sure.
Updated•6 years ago
|
Updated•2 years ago
|
Comment 7•8 months ago
|
||
Not sure what would be a reasonable value here, but my experimentation suggests this is good enough
Here's a profile of Jason's test case in the shell run with 300,000 iterations:
https://share.firefox.dev/4cd0JH0
icu_73::(anonymous namespace)::DecFmtSymDataSink::put
is the highest consumer of time now, and that's only 2.5%
Description
•