Closed Bug 134149 Opened 22 years ago Closed 22 years ago

CPU usage 100% when visiting http://www.omroep.nl/nos/nieuws/index.html

Categories

(Core :: DOM: Core & HTML, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 123273

People

(Reporter: ericdere, Assigned: jst)

References

()

Details

(Keywords: perf, qawanted)

CPU usage jumps to and remains at 100% when visiting
http://www.omroep.nl/nos/nieuws/index.html

Closing the tab/window reduces CPU load immediately.
Build 2002031104 (0.99 milestone) Windows NT
Confirming on linux 2002032808. Disabling JavaScript makes the CPU usage drop a
lot. I'd say the news ticker is a bit CPU greedy.
Assignee: asa → jst
Status: UNCONFIRMED → NEW
Component: Browser-General → DOM Level 0
Ever confirmed: true
OS: Windows NT → All
QA Contact: doronr → desale
We need a profile here... 
Keywords: perf, qawanted
Tried to profile it JS Debugger but I keep crashing or hanging -> bug 134377.
Changing URL, it's definitly the news-ticker.

Is there a step by step recipe on how to make a JS-Profile?
The right URL for real this time, sorry for the spam.
The news ticker is indeed the problem.  The JavaScript on that page boils down to:

  function doSomething() { /* do stuff */ setTimeout('doSomething()', 0); }
  doSomething();

doSomething() is called, which uses setTimeout() to call doSomething() again in
0 milliseconds.  Then that doSomething() calls doSomething() in 0 milliseconds.
 And on and on.

Mozilla is working like I would expect it to -- the JavaScript interpreter tries
calling doSomething() as often as possible, causing it to eat all available CPU
time.  If this behavior is undesirable, the JavaScript interpreter should impose
a minimum value on the 2nd argument to setTimeout().  In my testing, changing
the above code to use a delay of 1 cut CPU usage in half.
This is a duplicate of bug 123273.  (Sorry for the spam -- didn't realize it was
a dupe until well after I added my previous comment.)
So it is.  :)

*** This bug has been marked as a duplicate of 123273 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.