Closed
Bug 542032
Opened 15 years ago
Closed 13 years ago
Don't look up prefs on every tab & window close
Categories
(Firefox :: Session Restore, defect)
Firefox
Session Restore
Tracking
()
RESOLVED
FIXED
Firefox 11
People
(Reporter: zpao, Assigned: marco)
References
Details
(Keywords: perf, Whiteboard: [Snappy:P3])
Attachments
(1 file, 1 obsolete file)
6.73 KB,
patch
|
zpao
:
review+
|
Details | Diff | Splinter Review |
browser.sessionstore.max_tabs_undo is looked up every time a tab is closed. max_windows_undo is looked up every time a window is closed.
There's no need for that, so we should cache & observe changes.
Comment 1•15 years ago
|
||
This sounds as if occasionally looking up a pref were a bad thing. Do you have data showing that these lookups are in any way less efficient than installing yet another observer?
Reporter | ||
Comment 2•15 years ago
|
||
We're already doing 1+ lookups, so we can say those cancel out. So as long as the cost of the observer is less than the cost of all other lookups then this is a win. Creating the observer is likely cheap (maybe on equal costs as 1 or 2 lookups... though that's a completely unfounded statement).
I would say it's definitely worth it for max_tabs_undo. Maybe less so for max_windows_undo. Either way these prefs are unlikely to change more than once per session (probably closer to once in 50 sessions if that).
Comment 3•15 years ago
|
||
There's also some cost in keeping an observer around (which is what I'm concerned about) and some slight cost in the additional code.
Looking closer, it turns out that we do already have observers in place, though - so all that's left is caching the values...
Reporter | ||
Comment 4•15 years ago
|
||
(In reply to comment #3)
> Looking closer, it turns out that we do already have observers in place, though
> - so all that's left is caching the values...
Indeed (I completely forgot we were doing that). Ideally we'd do this like the prefs in bug 539660 so that it's lazy. That patch caused odd crashes though, so perhaps not.
Updated•15 years ago
|
Updated•13 years ago
|
Whiteboard: [tsnap] → [snappy]
Updated•13 years ago
|
Whiteboard: [snappy] → [snappy:p4]
Assignee | ||
Comment 5•13 years ago
|
||
Attachment #576233 -
Flags: review?(paul)
Reporter | ||
Comment 6•13 years ago
|
||
Comment on attachment 576233 [details] [diff] [review]
Patch
Review of attachment 576233 [details] [diff] [review]:
-----------------------------------------------------------------
First off, thanks for starting on this Marco! You're on the right track here, but you haven't solved the whole problem.
Here are the 3 steps to fixing this:
1. Make the pref value an attribute
2. Update the attribute when the pref value changes (see observe)
3. Use the attribute instead of looking up the pref when a tab/window is closed (see onTabClose and _capClosedWindows)
You've done step 1, but the other 2 steps still need to be done.
Attachment #576233 -
Flags: review?(paul) → review-
Assignee | ||
Comment 7•13 years ago
|
||
Thank you for your fast review :D
Assignee: nobody → mar.castelluccio
Attachment #576233 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #576252 -
Flags: review?(paul)
Reporter | ||
Comment 8•13 years ago
|
||
Comment on attachment 576252 [details] [diff] [review]
Patch v2
Review of attachment 576252 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me! Thanks Marco. I'll push this to try server just to make sure and then I'll get it checked in.
Attachment #576252 -
Flags: review?(paul) → review+
Updated•13 years ago
|
Whiteboard: [snappy:p4] → [Snappy:P3]
Reporter | ||
Comment 9•13 years ago
|
||
Whiteboard: [Snappy:P3] → [Snappy:P3][fixed-in-fx-team]
Comment 10•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [Snappy:P3][fixed-in-fx-team] → [Snappy:P3]
Updated•13 years ago
|
Target Milestone: --- → Firefox 11
You need to log in
before you can comment on or make changes to this bug.
Description
•