Only guess system timezone once per session

RESOLVED FIXED in Sunbird 0.3


13 years ago
12 years ago


(Reporter: Joey Minta, Assigned: Joey Minta)


Sunbird 0.3


(Whiteboard: [good first bug])


(1 attachment)



13 years ago
Currently, calendarUtils.js (used by both lightning and sunbird) has a
calendarDefaultTimezone() function that guesses the system timezone, if one is
not defined.  This is a rather expensive call to make though, as it iterates
through many timezones that have to be parsed from an ics file.  A better
solution would be to only guess the timezone on startup, and then cache that
value.  This would introduce the small downside that any changes to the system
timezone would require a restart to be recognized.  However, for an 0.x program,
that seems like a legitimate limitation, especially for the performance boost.

That code already caches, so we really only guess once. The result of the
guessing isn't stored, so on the next run the guess is made again. But never
twice in the same session.

I think this bug is worksforme.

Comment 2

13 years ago
OK, this is somewhat worksforme.  Using the patch from Bug 307344, I see proper
caching in calendarWindow.  However, anytime the event dialog opens, the guess
is re-run.  We should improve that, but since that's the only problem I see,
this bug is much less of a priority.

Comment 3

12 years ago
Good first bug: gDefaultTimezone becomes -1 again, since global variables belong to a specific window.  Perf related, so we want this for 0.3b (or whatever it's going to be called)
Whiteboard: [good first bug]
Target Milestone: --- → Sunbird 0.3
Reassigning all automatically assigned bugs from Mostafa to nobody@m.o

Bugspam filter: TorontoMostafaMove
Assignee: mostafah → nobody

Comment 5

12 years ago
Created attachment 231035 [details] [diff] [review]
use opener scope

This is a significant enough performance win that I'd like to get it for 0.3.  By calling calendarDefaultTimezone in the opener's scope, we can use that cached value, rather than re-guessing.  You should notice the performance win every time you open the event dialog.
Assignee: nobody → jminta
Attachment #231035 - Flags: first-review?(dmose)

Comment 6

12 years ago
Comment on attachment 231035 [details] [diff] [review]
use opener scope

Attachment #231035 - Flags: first-review?(dmose) → first-review+

Comment 7

12 years ago
patch checked in.
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.