[Ext] Session Manager 0.4 to 0.4.3

Announce and Discuss the Latest Theme and Extension Releases.
Locked
tmetro
Posts: 38
Joined: October 8th, 2004, 1:49 pm

performance

Post by tmetro »

zeniko wrote:I recommend you...change that interval to something around 30 or even 60 seconds to alleviate the issue.


I did and it seemed to help.

The more interesting question here is whether it is possible to reduce the impact of that save operation. It's too bad there aren't facilities in JavaScript to run code at a lower priority. But it may be possible to split up the task so the interruption is less noticeable. For example, saving 1/3 of the open tabs every period/3, or something. (If the biggest CPU hit is from writing crashrecovery.dat to disk, then doing the above might just make the problem 3 times worse.)


zeniko wrote:Yes, Session Manager has to parse the session files in order to extract the sessions' names...


And does 15 to 20 seconds seem like a reasonable time to scan 20 session files? (Not a fair comparison, but 'grep -e "^name="' runs in under a second.)

How about the delay in showing the options dialog? Unlike rendering the menu, whatever it is doing isn't cached, so the delay occurs every time, and uses up 100% of the CPU for the duration.

(Though neither of these affect normal browser usability, so not really worth much optimization effort.)


zeniko wrote:
tmetro wrote:(Does Session Manager hook into that event?)


It does so as well, but the impact should be minimal.


The impact from most of the things we are discussing should be and are minimal under normal circumstances. (The exception being saving sessions, as discussed above, which is not quite minimal, even under normal circumstances.) The problem is that once this threshold has been crossed in FF, it seems particularly sensitive to anything that runs JS code.


zeniko wrote:You might want to try to reduce the number of reopenable closed tabs to 3 (or even 0) to get more free memory...


OK, that's doable. When I initially installed Session Manager I had boosted both the number of tabs and windows to remember up to 10. I switched them back to 3 (which I think were the initial defaults).

I also had "List all closed windows and tabs in a submenu" checked, and so I unchecked it. It isn't clear whether this option is describing how the information is presented ("in a submenu" as opposed to what?) or if it is overriding the numbers entered above ("List *all* closed windows and tabs..."). If the latter, checking it should disable the text boxes. (Is there a Session Manager wiki?)

What kind of data structure is used to store the information that is only being kept in memory because of Session Manager? Does Session Manager do something like grab references to existing objects in FF, or does it replicate the data into its own data structures? Maybe those structures could be more compact or perhaps memory isn't getting freed after the replication.


zeniko wrote:...and set the maximum amount of saved POSTDATA to 0 which might also help.


Is that an overall setting or a per window/tab setting? Is it strictly POST data or does that also include cookies?

It was set to unlimited (the default, I presume). I set it to 4K, which I can't imagine having a significant impact on memory, and as I don't normally depend on Session Manager to save POST data, that should be adequate to save the state of a form in the event of a crash. (Though if that included cookies for all saved tabs, it's probably undersized.)


BTW, you have an "oldest to newest" option for ordering the session list; if that's selected, it'd be helpful if you scrolled the session selection list to the end of the list to show the most recently saved session.


zeniko wrote:
tmetro wrote:I've noticed on several occasions on startup that I'll be prompted by Session Manager to select a session, then a minute later I'll be prompted again...


Are you saying that you get the recover session dialog twice when you start Firefox?


Yes. Bug?

-Tom
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Re: performance

Post by old zeniko »

tmetro wrote:The impact from most of the things we are discussing should be and are minimal under normal circumstances. (The exception being saving sessions, as discussed above, which is not quite minimal, even under normal circumstances.) The problem is that once this threshold has been crossed in FF, it seems particularly sensitive to anything that runs JS code.

If Session Manager works well under normal circumstances (which it does), I'm quite satisfied. As you describe it, you simply run Firefox on an underpowered machine and get matters worse through memory leaks (I've rarely seen Firefox have more than a 100 MB footprint).

Session Manager has been optimized several times and is fast enough for myself and apparently most of its other users. And as long as I have to measure everything in milliseconds, I currently don't feel motivated to work further on this - I'm even far from convinced it'd be worth my time. You are of course free to have a look at its sources and even try to optimize it further.

tmetro wrote:Is that an overall setting or a per window/tab setting? Is it strictly POST data or does that also include cookies?

That's a per history entry setting. And POSTDATA doesn't include cookies.

tmetro wrote:
zeniko wrote:Are you saying that you get the recover session dialog twice when you start Firefox?

Yes. Bug?

Sounds like one. Are you able to reproduce that bug reliably on a clean profile?
User avatar
XerBlade
Posts: 865
Joined: October 4th, 2005, 10:45 pm
Location: Nashville, TN, US

Re: performance

Post by XerBlade »

zeniko wrote:If Session Manager works well under normal circumstances (which it does), I'm quite satisfied. As you describe it, you simply run Firefox on an underpowered machine and get matters worse through memory leaks (I've rarely seen Firefox have more than a 100 MB footprint).


I've seen Firefox reach slightly over a 400 MB footprint before. However, in my case, this still didn't have much noticeable impact on performance (take an already high-end system, upgrade it with more high-end components, and optimize the background tasks and OS as much as you can think to, and handling this kind of thing no longer becomes a big deal). Note that this was just before I finally did a full exit after a session where I had over 100 tabs open at once, twice in the same session (my average open tabs when on this forum is about 12, btw -_-).
User Agent
Extensions
AMD64/2.41GHz RAM/1.0GB ATI/256MB-GDDR3/128-bit/8xAGP Cable6.0M/384kbps
SevenSeven
Posts: 33
Joined: February 8th, 2004, 1:05 pm

Post by SevenSeven »

zeniko,

Would it be possible to display the url's of the closed tabs in the Undo Close toolbar button menu in the status bar and/or tooltips?

Why is it there is no Clear 'Closed' List in the menu of the Undo Close toolbar button or the Tools menu for Firefox? I added it myself and no problems.
Tahattmeruh
Posts: 5
Joined: March 7th, 2006, 10:46 am

Display a warning page instead of potentially crashing conte

Post by Tahattmeruh »

> Display a warning page instead of potentially crashing content

This feature is working very well for me in the last test versions.
When will you implement it in the standard version?
Muescha
Posts: 53
Joined: February 17th, 2005, 9:18 am
Location: Germany

Post by Muescha »

zeniko wrote:
tmetro wrote:Is rendering the menu dependent on parsing the session files or something?

Yes, Session Manager has to parse the session files in order to extract the sessions' names (it does however cache the names so that it doesn't have to read them more than once per window).



i think the "script timeout" error comes up, if there are many and large *.session files

test it: move all *.session files from the sessions folder in your private folder to any backup folder

the caching of the session names not in memory between different starts of session manager, so you need to wait for each first start of session manager to cache all the *.session data


like i posted this issue early in this thread:
PostPosted: Apr Fri 28th 2006 4:19pm
http://forums.mozillazine.org/viewtopic ... t=#2233002

Muescha wrote:3) Time for listing Sessions


if you have many saved sessions: open dialog or the drop down list take to much time.


Reason:
in getSessions the code read for each session the full session file with gSessionManager.readSessionFile , but for sessions you need only the the first 2 lines with "^\[SessionManager\]\n(?:name=(.*))?".

Solution!?
it would be faster if you only read the first part of the file.

or you cache this this data saved in a seperate .session.info file with this information for faster access.
SevenSeven
Posts: 33
Joined: February 8th, 2004, 1:05 pm

Post by SevenSeven »

Hello all,

To satisfy my own requests, I learned some JavaScript and made a userChrome.js snippet for Session Manager Undo Closed Tabs. It adds the Clear 'Closed' List menuitem and displays the uri's of closed tabs in tooltips and in the statusbar. If anyone knows how to improve it, please do tell. Zeniko, maybe the display of uri's should be a part of the original extension; of course, I'm not suggesting to use my beginner code.

Code: Select all

/*::::::: Extension to sessionmanager-undo :::::::*/

var extensionToSMundo = {
   init: function() {
      var menu = document.getElementById("sessionmanager-undo").firstChild;
      if (menu) {
         var menuSeparator = document.createElement("menuseparator");
         menuSeparator.setAttribute("_id", "end-separator");
         menu.appendChild(menuSeparator);
         var menuItem = document.createElement("menuitem");
         menuItem.setAttribute("label", "Clear 'Closed' List...");
         menuItem.setAttribute("accesskey", "C");
         menuItem.setAttribute("oncommand", "gSessionManager.clearUndoListPrompt();");
         menu.appendChild(menuItem);
//         menu.addEventListener("popupshowing", extensionToSMundo.initTooltips, false);
         menu.addEventListener("DOMMenuItemActive", function(event) { extensionToSMundo.displayOnStatusbar(event); }, false);
         menu.addEventListener("DOMMenuItemInactive", function(event) { extensionToSMundo.clearStatusbar(event); }, false);
      }
   },
   
   initTooltips: function() {
      if (gSessionManager.mClosedTabs.length) {
         var menu = document.getElementById("sessionmanager-undo");
         var tabsMenu = menu.getElementsByAttribute("_id", "tabs")[0].nextSibling;
         var i = 0;
         if (tabsMenu.tooltipText == '') {
            while (tabsMenu.tooltipText == '') {
               tabsMenu.tooltipText = extensionToSMundo.getURI(i);
               tabsMenu = tabsMenu.nextSibling;
               if (!tabsMenu.hasAttribute("oncommand")) return;
               i = i + 1;
            }
         }
      }
   },
      
   displayOnStatusbar: function(evt) {
      if (/gSessionManager\.undoCloseTab\((\d+)\);/.test(evt.target.getAttribute("oncommand"))) {
         document.getElementById("statusbar-display").setAttribute("label", extensionToSMundo.getURI(RegExp.$1));
      }
   },
   
   clearStatusbar: function(evt) {
      document.getElementById("statusbar-display").setAttribute("label",'');
   },
   
   getURI: function(i) {
      var match = /Entry1\]\nuri\=.+/m.exec(gSessionManager.mClosedTabs[i].state);
      return match[0].substr(12,match[0].length);
   }
   
};
extensionToSMundo.init();
User avatar
dougeeebear
Posts: 548
Joined: September 15th, 2005, 4:17 pm

Post by dougeeebear »

SevenSeven,
The Clear 'Closed' List menuitem addition is a nice touch.
However, just FYI, the tooltips and statusbar display don't work for me (which is fine, because I don't really want them anyway).
george27
Posts: 94
Joined: June 15th, 2004, 9:53 am

Post by george27 »

In all in one sidebar the bookmarks sidebar pane when a bookmark is clicked and loads the pane goes blank under session manager 4.2 & dev build. When session manager is disabled this stops.
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

george27 wrote:In all in one sidebar the bookmarks sidebar pane when a bookmark is clicked and loads the pane goes blank under session manager 4.2 & dev build. When session manager is disabled this stops.

I'm not able to reproduce this issue. Does this still happen with only Session Manager and AioS 0.6.4 installed on a clean profile? If so, do you get any errors in the JavaScript console (having set javascript.options.showInConsole to true)?
danqing
Posts: 1
Joined: June 24th, 2006, 7:56 am

Post by danqing »

I found a problem. The saved session files store many fields in a entry. The 'title' field contains the title of a web page. However, I found it would be messed if it's not a english one. For example, the title of the page http://movie.starblvd.net/cgi-bin/movie ... tmare.html contains tranditional chinese words and encoded in Big5, but the title stored in the 'title' field would not be encoded in Big5 or UTF-8 or the one I know. In that way, restoring saved sessions would malfunction if this page was in the sessions. Is it a bug? I would appreciate any help. Thanks.
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

@danqing: This is indeed a bug. The updated <a href="http://www.haslo.ch/zeniko/software/sessionmanager-dev.xpi">testing version</a> (0.4.2.1+) should fix this issue.
avinash.aithal
Posts: 24
Joined: November 23rd, 2005, 9:38 pm

Can I add another tab to an already saved session?

Post by avinash.aithal »

I can always open the session in a new window, add another tab for the new link and then save the session. I was just wondering if there is an aliter.

Regards,
Avinash.
old zeniko
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old zeniko »

@Avinash: There's in fact no easier way of adding a tab to an existing session (and there probably won't be, either).
********
Posts: 947
Joined: August 24th, 2005, 12:23 pm

Post by ******** »

in the 20060629 branch nightly, the session restoring seems really slow. it keeps trying to load the homepage and then clears it and starts restoring session slooowwwly.
and every time i restart, it restores the first tab correctly but all the other tabs get their order reversed.
it worked much better in the 20060623 nightly.
oh well.

at least, session manager is working perfectly as usual :)
Locked