Closed Bug 530607 Opened 15 years ago Closed 13 years ago

Enabling javascript causes high CPU and memory usage spikes

Categories

(Core :: JavaScript Engine, defect)

1.9.1 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: funtoos, Unassigned)

Details

(Whiteboard: [closeme 2011-01-31])

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091110 Gentoo Firefox/3.5.5
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091110 Gentoo Firefox/3.5.5

I was observing continuous high usage by firefox on my laptop and tried to see if I can nail it down to some add-on or a feature. This is what I arrived at finally: Javascript is a CPU and memory hog. This is what I did to test this.

1. Disabled javascript and restarted firefox in safe mode.
2. Opened about 25 tabs(my usual websites) in 3 windows. Two of these are known to use javascript: gmail and yahoo mail.
3. Let it idle for a bit.
4. Fired: fpid=`/bin/ps -aef|grep [f]irefox|awk '{print $2}'`;top -b -p $fpid|grep $fpid and routed to a file for 30 seconds.
5. Then, I enabled JS and restarted firefox in safe mode.
6. Opened the same set of tabs.
7. Let it idle.
8. Fired the same command again with a different output filename.

Results are attached. As you can see, the memory footprint is much bigger with JS enabled. CPU usage in general is always greater than 5% (never 0%) and spiking whenever yahoo mail or gmail refreshes, whereas without JS, it drops to 0% when idling and is mostly below 5%.

Reproducible: Always

Steps to Reproduce:
1. Enabled JS and run
2. Higher CPU usage and memory usage
3. Disable JS and compare.
Attached file Without JS
CPU usage less than 5% and 0% idling.
Attached file With JS enabled.
Higher memory usage, higher CPU usage spikes at 38%. Generally, the CPU usage is high (most samples greater than 5%) although the browser is idling.
This basically eats up my laptop battery just lying idle. So, its a major problem.
Lots of web apps use JS timers with a high frequency. 38% sounds a bit insane though.
please provide a couple URLs that cause this behavior
Keywords: testcase-wanted
Whiteboard: [closeme 2010-12-15]
I use yahoo mail and gmail. So, those are my URLs for testing it. That's what most end users will likely use and see javascript eating CPU on a laptop. I don't know of any other URLs which can be used to trigger the same behavior.
Could you update to 3.6.13 and then see if the issue occurs with a new, empty profile:
http://support.mozilla.com/en-US/kb/Basic%20Troubleshooting#w_make-a-new-profile

Thanks!
Whiteboard: [closeme 2010-12-15] → [closeme 2011-01-31]
Version: unspecified → 1.9.1 Branch
Whiteboard closeme date been and gone, so marking as incomplete.

Please comment on/reopen this issue if it still occurs - and see comment 7 - thanks!
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: