Closed Bug 1543675 Opened 8 months ago Closed 5 months ago

Replace UNumberFormat with UNumberFormatter

Categories

(Core :: JavaScript: Internationalization API, task, P2)

task

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox68 --- wontfix
firefox69 --- wontfix
firefox70 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(2 files)

Supporting formatToParts for BigInt requires to use UNumberFormatter, because UNumberFormat only supports unum_formatDecimal, which can be used for Intl.NumberFormat.prototype.format, but no UFieldPositionIterator overload which is needed for formatToParts. UNumberFormatter provides unumf_resultGetAllFieldPositions, enabling us to support formatToParts with BigInts.

Switching to UNumberFormatter will also be needed for the Intl.NumberFormat Unified API proposal.

Blocks: 1543677
  • Add NumberFormatterSkeleton as a helper class to construct a number formatter
    skeleton. When the "Intl.NumberFormat Unified API" proposal gets implemented
    a more feature-rich class may be necessary.
  • In addition to a UNumberFormatter instance, NumberFormatObject now also
    stores a UFormattedNumber instance. This avoids a performance regression
    compared to creating a new UFormattedNumber object each time a number gets
    formatted. (In µ-benchmarks 20% regressions were seen, with a cached
    UFormattedNumber the same µ-benchmarks even improved by ~33%.)
  • Add accessors for reserved slot values to NumberFormatObject to improve
    readibility.
  • Update Intl.PluralRules to use UNumberFormatter, similar to the updates in part 1.
  • Cache the UFormattedNumber instance to turn a performance regression into a
    performance improvement.

Depends on D27083

Type: defect → task

You want me to address the nits in these and land the patches here? Presumably this concern impedes most other patching in this area, given the change from one API style to a very different one, and that likely affecting lots of other things (e.g. bug 1514851).

Flags: needinfo?(andrebargull)
Priority: -- → P2

There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:anba, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(andrebargull)

Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f572fd2e9c81
Part 1: Change Intl.NumberFormat to use UNumberFormatter API. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/1d149c2aa629
Part 2: Change Intl.PluralRules to use UNumberFormatter API. r=jwalden

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

You need to log in before you can comment on or make changes to this bug.