Closed Bug 1435325 Opened 6 years ago Closed 6 years ago

Cache URelativeDateTimeFormatter for Intl.RelativeTimeFormatObject instances

Categories

(Core :: JavaScript: Internationalization API, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

Caching URelativeDateTimeFormatter avoids creating new ones for every call to Intl.RelativeTimeFormatObject.prototype.format().
Attached patch bug1435325.patchSplinter Review
Adds caching for URelativeDateTimeFormatter to Intl.RelativeTimeFormat.

I've also changed |intl_FormatRelativeTime()| to pass the Intl.RelativeTimeFormat's type from JS->C++, because that avoids a slow-ish C++->JS call when calling |GetInternalsObject()|. And I've changed some lines so they don't exceed the 99 chars per line limit.
Attachment #8947924 - Flags: review?(gandalf)
Comment on attachment 8947924 [details] [diff] [review]
bug1435325.patch

lgtm!
Attachment #8947924 - Flags: review?(gandalf) → review+
Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/af6cc52c9b8b
Cache URelativeDateTimeFormatter in Intl.RelativeTimeFormat. r=gandalf
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/af6cc52c9b8b
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: