Closed Bug 2008667 Opened 9 months ago Closed 9 months ago

Improve recurrence end date calculation and calendar start-up time

Categories

(Calendar :: Internal Components, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED
148 Branch

People

(Reporter: darktrojan, Assigned: darktrojan)

References

Details

(Keywords: perf)

Attachments

(2 files, 1 obsolete file)

In bug 1590665 I introduced an optimisation to avoid recalculating occurrences of events that had stopped recurring. While this worked as intended, it meant we had to calculate all occurrences of each event even if they happened well after the date range in question, so this made performance worse for some things.

Here I'm going to change how this optimisation works, to stop calculating occurrences after the date range in question. If we need a later date range the calculation will happen again. This should massively reduce the work done at start-up (immediately after the main window appears, but blocking the main thread so Thunderbird appears unresponsive) where the alarms service asks for all occurrences of everything.

Attachment #9535848 - Attachment is obsolete: true

If a recurrence rule is immutable, the occurrences will never change, so there is no need to
calculate them more than once. In this patch I've added code to run through the calculation only
once (and only as far as is needed at the time), remember the output, then use the remembered
values for subsequent calls.

This optimisation makes the earlier recurrenceEndDate optimisation unnecessary, so I've removed
it. There is still potential for further optimisation using precalculated event start and end
times, but I've not investigated it yet.

Target Milestone: --- → 148 Branch

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/e87151847aad
Periodically yield the event loop while fetching calendar events from the database. r=mkmelin
https://hg.mozilla.org/comm-central/rev/6e76439652f7
In immutable recurrence rules, remember calculated occurrences for later reuse. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: