Closed Bug 1565176 Opened 7 months ago Closed 6 months ago

Prefer UFormattedValue API when available

Categories

(Core :: JavaScript: Internationalization API, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(2 files)

The new UFormattedValue API is slightly faster (~5% in µ-benchmarks) than what we're currently using.

Instead of first collecting all formatted-number field positions into
UFieldPositionIterator and then iterating over the position iterator, the new
UFormattedValue API allows direct iteration, resulting in a slight performance
improvement.
And using ufmtval_getString will additionally allow us to access the
underlying formatted string directly, which saves us a copy via
unumf_resultToString, leading to another minor performance improvement.

Pushed by btara@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/abeee4a000cc
Part 1: Prefer UFormattedValue API when available. r=jwalden
https://hg.mozilla.org/integration/autoland/rev/0f7682e2f001
Part 2: Use infallible shrinkBy instead of resize when reducing Vector storage. r=jwalden

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
You need to log in before you can comment on or make changes to this bug.