Closed Bug 1660692 Opened 4 years ago Closed 4 years ago

calDateTimeFormatter.inTimezone could be more efficient

Categories

(Calendar :: Internal Components, defect)

defect

Tracking

(thunderbird_esr78 wontfix)

RESOLVED FIXED
86 Branch
Tracking Status
thunderbird_esr78 --- wontfix

People

(Reporter: standard8, Assigned: darktrojan)

References

Details

(Keywords: perf)

Attachments

(1 file, 1 obsolete file)

I'm working on adding a test for the amount of accesses of preferences on startup. I noticed that intl.regional_prefs.use_os_locales is access about 100 times.

A lot of these accesses (~90) are via calDateTimeFormatter#inTimezone -> MozDateTimeFormat -> getLocales.

The obvious issue is that the formatter might be constructed twice if the date has a timezone, this should be able to be avoided.

The other thing that might be possible is to cache the formatter in the calls to inTimezone. This might, of course, depend on how frequently the timezone might be different, but would at least give some possibilities for improvement when it is all the same.

Keywords: perf
Component: General → Internal Components

Would you expect this to have only minor performance impact, i.e. not likely to be noticeable by itself, <2sec?

Flags: needinfo?(standard8)

(In reply to Wayne Mery (:wsmwk) from comment #1)

Would you expect this to have only minor performance impact, i.e. not likely to be noticeable by itself, <2sec?

Probably not noticeable by itself, but would definitely be worth doing as part of general startup performance and probably application performance.

Flags: needinfo?(standard8)
Severity: -- → S4
Assignee: nobody → geoff
Status: NEW → ASSIGNED

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/bd4299747089
Remove intl.regional_prefs.use_os_locales from the list of problematic start-up prefs. r=Standard8

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 85 Branch

Ah, spoke too soon. Bug 1635561 did improve the count, but that's because it didn't work properly. Back to square one here.

Assignee: geoff → nobody
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: 85 Branch → ---
Assignee: nobody → geoff
Attachment #9192093 - Attachment is obsolete: true
Assignee: geoff → nobody

In testing, this saves thousands of calls to new Services.intl.DateTimeFormat and hundreds of calls to the preferences service.

Assignee: nobody → geoff
Target Milestone: --- → 86 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/f6f7743a893b
Prevent redundant calls to new Services.intl.DateTimeFormat and preferences service in hot code paths. r=mkmelin

Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Regressions: 1689775
Regressions: 1918010
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: