Closed Bug 1974378 Opened 1 year ago Closed 1 year ago

Move default locale and time zone cache from JS to C++

Categories

(Core :: JavaScript: Internationalization API, task)

task

Tracking

()

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(4 external files)

Move localeCache and timeZoneCache from selfhosted JS to C++. This avoids multiple JS -> C++ to get default locale resp. time zone and allows to re-use more code from Temporal.

Using a Vector requires less code, because it's no longer necessary to
manually check that the string fits into the buffer. Give the vector the same
stack storage size as the previous array, so there aren't any extra
allocations.

Part 2 will use the same approach for caching the system time zone.

Cache the system time zone identifier to avoid repeatedly calling into ICU.
This avoids performing char16_t to char conversions, because the time zone
identifier is guaranteed to be ASCII-only, even though ICU returns it as a
char16_t string.

Moves the default locale cache from JS to C++. Getting the default locale is
now about twice as fast as before, because there are now fewer JS->C++ calls.

Getting the default time zone is now also twice as fast, similar to the
improvements from the previous part. And this allows to reuse more code
from Temporal.

Pushed by andre.bargull@gmail.com: https://github.com/mozilla-firefox/firefox/commit/9e41a8068903 https://hg.mozilla.org/integration/autoland/rev/6560f79cc805 Part 1: Use a Vector for DateTimeInfo::timeZoneDisplayName. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/a59bc8a2f298 https://hg.mozilla.org/integration/autoland/rev/b60f71bba94d Part 2: Cache system time zone identifier. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/bd1c7f4113dd https://hg.mozilla.org/integration/autoland/rev/19414c849b08 Part 3: Store the computed default locale in GlobalIntlData. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/87e1cf4071e5 https://hg.mozilla.org/integration/autoland/rev/21c3fdf50e2e Part 4: Store the computed default time zone in GlobalIntlData. r=spidermonkey-reviewers,dminor

Backed out for causing SM bustages failures at DateTime.h
- Backout link

- Push with failures

- Failure log

  • Failure line:
    /builds/worker/checkouts/gecko/js/src/vm/DateTime.h:73:27: error: no member named 'intl' in namespace 'mozilla'
Flags: needinfo?(andrebargull)
Flags: needinfo?(andrebargull)
Pushed by andre.bargull@gmail.com: https://github.com/mozilla-firefox/firefox/commit/8c8ae73808bf https://hg.mozilla.org/integration/autoland/rev/b1e4c1e9bea3 Part 1: Use a Vector for DateTimeInfo::timeZoneDisplayName. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/7951777f81dc https://hg.mozilla.org/integration/autoland/rev/13612c37af8d Part 2: Cache system time zone identifier. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/90354dda0499 https://hg.mozilla.org/integration/autoland/rev/b2c4068a2448 Part 3: Store the computed default locale in GlobalIntlData. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/257487e8514e https://hg.mozilla.org/integration/autoland/rev/56af048b065d Part 4: Store the computed default time zone in GlobalIntlData. r=spidermonkey-reviewers,dminor
QA Whiteboard: [qa-triage-done-c143/b142]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: