Folders4Gmail

By Arend Last update Mar 4, 2010 — Installed 163,637 times.

CPU

in
Subscribe to CPU 22 posts, 9 voices



Andries User
FirefoxWindows

Everyone,

I now have Folders4Gmail working again. Great! But it comes with another issue. It now eats up all of my CPU. I did not have this problem before. And if I uninstall Folders4Gmail, the problem goes away. But with this script running, my CPU usage is nearly constantly at 90% or above.

Anyone else with this problem? And any idea of how to resolve it?

Andries

 
Slartibartfarst User
FirefoxWindows

@Andries:
I shall start by saying that IMHO Folders4Gmail is a great script and is to Arend's credit.

However, there has been a longstanding problem with Folders4Gmail regarding excessive processor (CPU) utlisation and overheating, but the author's (i.e. Arend's) stated opinion (see discussion "processor demanding issue?" elsewhere in this forum) is that it is OK, and he presumably does not intend to do anything about it. The script loops a lot on redrawing, so as to reflect an up-to-date view of a potentially dynamically changing state (i.e., the state of your labels and the emails they are assigned to).

(As an aside, regardless of how good a script is, the potential for being dictated to by other peoples' unsubstantiated opinions as to the validity of my experience in using a script is one of the reasons I dislike using scripts.)

From my observations, the Folders4Gmail CPU problem seems to vary in magnitude depending on the number of labels in use and the type of CPU being used.

For example:

(a) on my laptop (Intel Centrino duo CPU) the effect of enabling Folders4Gmail is instantaneous, and I have to switch Folders4Gmail off because of the problem. I have LOTS of labels. CPU utilisation maxes at 50% (equivalent to the whole of one CPU), CPU temperatures rise very fast (SpeedFan starts blowing at full speed) and system response goes down to a crawl or a halt. I have sometimes had to to shut down Firefox via Task Scheduler, just to get the system speed up so that I can restart F/fox and disable Gmail or Folders4Gmail and Greasemonkey. I now have Folders4Gmail permanently disabled as an add-on and in Greasemonkey, because of this limitation.

(b) In a single Centrino CPU desktop, the problem does not seem so bad, but gradually response times seems to increase and either F/fox or Gmail needs to be restarted. I have no idea why this behaviour is so different to my laptop's Centrino duo CPU.

Out of interest, you might like to compare the CPU problem you have with Folders4Gmail with two other labelling scripts that also hammer the CPU:

(i) "Processor Friendly Folders4Gmail": which seems to alleviate but not cure the problem on my laptop, and I do not use it for the same reasons as above.

(ii) "LabelLinks4Gmail": which takes the Folders4Gmail concept into a new dimension. IMHO this script is nothing short of brilliant - it needs to be used to be appreciated. Unfortunately, to use it effectively, you are obliged to structure your labels differently to Folders4Gmail's label structure (so you cannot easily switch between the two and you would need to keep two sets of label profiles anyway, to do so - which is tedious), and it hogs the CPU twice as much, so is only really usable in short bursts. I therefore keep it disabled most of the time too. Such a pity. Such a great script.

Hope this is of help/use to someone.
Thanks to Arend for creating the Folders4Gmail script.

 
Arend Script's Author
FirefoxWindows

Yes, you are right. With the new update Folders4Gmail takes a lot of CPU. A much bigger problem than before. On my laptop it's typically around 20% CPU usage compared to nearly 0% without :-(

Anyone reading this, what is your Firefox CPU usage with Folders4Gmail compared to Firefox without it?

The script constantly looks for updates to the labels (label deleted, added or unread count changed). It is set to check every second but that is probably too often. I might have to set the checking to a longer intervall. Or find a way to make the checkForLabelUpdates function more efficient.

If you don't want to wait for an update to the script, or it is a big issue with your computer, you can edit the script yourself:
In Firefox go to Tools > Greasemonkey > Manage User Scripts
Select Folders4Gmail on the left side and click the Edit button
Search for this line: window.setTimeout(checkForLabelUpdates, 1000);
The time is given in Milliseconds, so 1000 means one second. Set it to something higher.

Hope that helps,
Arend

 
Gavan Watson User
FirefoxWindows

I was in the same boat with F4G eating CPU cycles—changing the interval to 5000 has alleviated the problem. Thanks for the great script & the suggestion.

 
Andries User
FirefoxWindows

Arend,

I followed your suggestion, and it completely solved the CPU problem. My CPU usage went from 80%+ to around 10%.

Thank you!

Andries

 
Jutin User
FirefoxWindows

When I hit edit it brings up a dialog to select a file. Where is this script located?

 
Jutin User
FirefoxWindows

nevermind, it was asking me to select an editor.... stupid vista...

 
Arend Script's Author
FirefoxWindows

After you guys pointed out the excessive CPU usage, I had a look at the script again and found a stupid mistake that led to too much CPU usage.

I hope the problem is fixed now with version 1.52. Does your CPU usage go down after you install the latest version?

 
Gavan Watson User
FirefoxWindows

Just installed 1.52 and CPU usage seems to be fine. Mind you it's only been a minute. If CPU usage spikes, I'll let you know.

 
cablop Scriptwright
FirefoxWindows

Yes i was using this script, and i liked it too much.

But in fact, i think to redraw the labels every 100 ms is to excessive, nobody will make a new lable and in less than 0.1 seconds go to check the labels list.

Now, it is working at 1 sec, isn't it?

I think you can lower it more. Why? Cause we are designing/developing for people, not for machines.

If you change a label, create or delete one you don't go directly to the labels to see if the change was made. The time between those actions is a few seconds... how many? I think there's no statistics for it, but in my opinion from 3 to 10 seconds in label addicted users and 1 to 3 minutes to not label addicted users.

Also you have to consider that creating a new label takes one second or above in google, cause it involves client-server interaction.

As i stated before, we are developing for users, not for computers.

OK. I remembered you said something like you don't expect this script to eat too much CPU on an old computer. But i'm not talking about computers.

I suggest this test. Install a Virtual Machine in a computer running Linux, install Windows inside the Virtual Machine, install Macromedia or Corel inside that Windows. Install Folders4Gmail in either firefox (host linux ff or guest windows ff). Then Open your inbox and try to edit a complex vector image in corel or to make a flash. Then you realize your script is eating too much CPU for just an aesthetic personal preference, that is to reflects changes on labels, and you can't use your CPU power to do Corel or Flash tasks with ease cause your Virtual Machine becomes laggy. In fact this is the way i discovered my CPU was being ate for an unknown reason, i can't make a simple dot grid on Corel inside my vbox machine while running ff on ubuntu, oncle i closed the inbox, voila!, i can work on Corel with no problem!

In few words... If Corel running inside a Windows XP inside a Virtual Machine doesn't cause lag to my computer, read well a whole COREL... why a simple javascript would eat my CPU?

 
Arend Script's Author
FirefoxWindows

Yes, refresh is now every 1 second. If you want a longer delay, you can search for this line in the script:
window.setTimeout(checkForLabelUpdates, 1000);

And replace 1000 (= 1 sec) with something higher.

 
Slartibartfarst User
FirefoxWindows

@Arend:
Thankyou for the tip to amend the F4GM:
"window.setTimeout(checkForLabelUpdates, 1000);
And replace 1000 (= 1 sec) with something higher"

I changed the setting from 1,000 to 5,000, and the CPU hogging reduced dramatically - but still not enough - it still hits 50% peaks and overheats the CPU, but less frequently than before. :-)

I am working in such a way as I require a fast response from my info. mgmt. system. I have never had this this with the latest version of Gmail. To test if this was attributable to inefficiencies in Gmail, I switched to the old version of Gmail, and was able to confirm that the F4GM functions fine there too, and Gmail is a lot faster than the newer version. I had observed this before, so it was nothing new. I guess all that new functionality in Gmail2 plus Lifehacker's BetterGmail is nice to have (if not highly desirable), but I have lost patience. I did turn to Google Chrome as an alternative, but that seems to be getting pretty bloaty and flaky lately too, and it does not have all that extra stuff I depend on in my F/fox add-ons.

By the way, I disabled the F4GM in the BeterGmail2 add-on, but left the F4GM Greasemonkey script untouched after setting the 5,000 delay. It works OK in the new and old versions of Gmail - except it still overheats in the new version.

Yet Google just took Gmail out of ß! Hmmm.

Sorry if this seems a bit garbled, but I am cutting my sleep and running on caffeine so as to get some work out the door.

 
Arend Script's Author
FirefoxWindows

@Slartibartfarst
Did you install yesterday's update of Folders4Gmail (version 1.52)? It should greately reduce CPU usage.

 
Slartibartfarst User
FirefoxWindows

@Arend: Yes, I was using v1.52 (as given in the script). :-(
I updated to and installed that version as soon as I read your post above, and made the change to the wait time (5,000) after installing it. Restarted F/fox, etc., too - just in case. Something is definitely thrashing the CPU in F/fox, and it's exacerbated under the Gmail new version - especially when F4GM is enabled. It's blown out of sight if I disable F4GM and enable LabelLinks4Gmail - which makes me suspect there is a common factor somewhere.

 
Slartibartfarst User
FirefoxWindows

@Arend: Possibly useful additional information confirming some of my posts above.
I have been running BetterGmail with the F4GM option deselected, and with the Greasemonkey F4GM script enabled.
F4GM labels seem to work fine in Gmail newer version and Gmail older version.

In the newer version, CPU occupancy is higher at the outset, but not too bad. The cooling fan comes on a bit. After a variable amount of time (it is not consistent), the CPU occupancy starts to creep up and peak at 50% on my Centrino Duo CPU. If I then switch Gmail to the older version, CPU occupancy goes right down to a 9% or so - negligible. After a few minutes, if I switch back to Gmail newer version, then we go back to the start of this paragraph.

 
Bilz User
FirefoxWindows

My work e-mail transitioned to Google Apps for Education a few days ago, and so I am trying to get GMail set up the way I'd like. I've installed Better GMail 2 on Firefox 3.5.1 and I get the same CPU issues with F4GM that everyone else reports.

As per the advice in this forum, I unchecked F4GM in Better GMail 2 and installed the stand-alone script (v. 1.52). I altered the ""window.setTimeout(checkForLabelUpdates)" entry incrementally (in 5000 blocks) up to 25,000 and it made no appreciable difference.

F4GM will load, but I have to hit "Continue" in Firefox's "Warning: Unresponsive Script" 4 or 5 times (about 75 seconds total) before the script loads successfully. CPU usage spikes to 100% each time the script is continued, from Firefox's normal 3-5%.

F4GM is a really great concept, and once it loads it does everything I want it to do. But the load itself is onerous. Does anyone have any further suggestions for working around this?

 
Arend Script's Author
FirefoxWindows

If you have problems loading, try to search for
window.setTimeout(waitForLoading, 500);
and increase the 500 number. Maybe that helps.

Do you have a lot of labels? Or maybe very few?

 
Bilz User
FirefoxWindows

@Arend
Thanks for your reply. I do have a lot of labels, and it does appear as though that is what is taking the time to load. I changed the "window.setTimeout(waitForLoading, 500);" incrementally up to 25,000, and I'm afraid that made no difference.

 
Jim Reisert User
FirefoxWindows

Any progress on this? I have a Pentium 4 computer that can not use this script without the script timing out. I have over 100 folders.

 
Kendra Tupper User
FirefoxWindows

I am also having major problems with CPU in Firefox (version 3.5.2). I have the new version of F4GM installed and made changes to the wait time and load time. I have over 100 nested folders, but I never had this problem with the script until recently.

 
cablop Scriptwright
FirefoxWindows

It is not easy to reach the place to put timers up, i think you can put a set of variables at the beginning of the script to make it easy for us...

anyway, it's still too CPU demanding

not only for that refresh rate but also it tries to load at the very beginning, so when gmail is still loading it causes gmail to fail to completely load...

and i saw at least two places with time interval and one tof them is still at 100 ms...

i still say this script is not CPU friendly, not users oriented...

 
cablop Scriptwright
FirefoxWindows

i was using more than ten labs and tested them against your script, your script eats more CPU than TEN gmail labs!!

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel