Closed Bug 132974 Opened 22 years ago Closed 22 years ago

onLoad JavaScript on www.ihk-bonn.de causes Mozilla to hang for several secs with 100% CPU consumption

Categories

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

x86
All
defect

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: mop, Assigned: jst)

References

()

Details

(Keywords: hang, perf)

Attachments

(2 files)

try opening the url. 0.9.8, 0.9.9 and a recent cvs build seem to hang for about
10 seconds before the page is rendered.
Works for me too :-(

Using : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:0.9.9+) Gecko/20020322
Confirmed W2K 2002031104. I see CPU maxed out for about *45 secs* on 700MHz
Duron w/ 256MB. This occurs as soon as the page has finished downloading (it has
already started to render by then), so I suspect it's the function pageInit()
called in the BODY onLoad that's taking the time.

I see no errors in the JS console, and IE5.5 has no trouble. Could someone with
more time do some debugging and find out exactly what takes so long?

Resummarising to make it easier to find, and reassigning to the JavaScript people.
Assignee: asa → rogerl
Status: UNCONFIRMED → NEW
Component: Browser-General → JavaScript Engine
Ever confirmed: true
QA Contact: doronr → pschwartau
Summary: mozilla hangs for about 10 secs with 100% CPU consumption → onLoad JavaScript on www.ihk-bonn.de causes Mozilla to hang for several secs with 100% CPU consumption
Attached file js profile
Looks like the slowdown is from the dynamic menus.
Attached file jprof profile
To DOM core...

A quick look over the js showed the following code in DynLayerInit:

     for (var i = 0; i < document.getElementsByTagName("div").length; i++) {
       var divname = document.getElementsByTagName("div")[i].id
       var index = divname.indexOf("Div")
       if (index > 0) {
         eval(divname.substr(0,index)+' = new DynLayer("'+divname+'")')
       }
     }

There are 336 divs on the page, so we end up creating 772 NodeList objects all
of which are observing the document and all that.  Just changing that code to
only getElementsByTagName() once made the pageload about twice as fast over
here.  (Note, the code is just a copy of the IE code with
document.all.tags("div") replaced with the |getElementsByTagName| call.

ccing shaver and jesup because once I changed this reflow was the big culprit in
the loadtime.

Thought:  Could we cache nodelists created by getElementsByTagName off the
          document in a hash by nodename or something?  I realize that this is
          "bad" JS practice, but apparently this is common after all (if
          dynlayer.js uses it, it's common).
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Core
Keywords: perf
QA Contact: pschwartau → stummala
Blocks: 118933
Keywords: hang
Priority: -- → P3
Depends on: 140758
build 2002051104 (it has the fix for bug 129115) essentially fixed this bug:
IE delay (after loading from local copy): 4 sec
Moz 2002051104 delay: 6 sec
Moz 7 May: hang
I saw similar performance when loading from the network. Cpu usage was 100% for
both IE and Mozilla, after loading the page. System specs: K6-III/400, 192MB, Win2K.
Tested this one with Mozilla 1.2b trunk build 2002101508 running under Mac OS
9.2.2, iMac DV G3/400, 192 MB RAM.

Doesn't seem to happen under Mac OS, FWIW.  Perhaps this is now fixed?
I'd say this is fixed - just tested on 2002091014 (1.2a) under Win2K, on 1GHz
PIII with 256MB, and it loaded fine. IIRC they've redesigned the site since this
bug was first filed, so that could be the reason, but see comment 6.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → WORKSFORME
verifying wfm with 2002101708, Win2k, 400 MHZ cpu.
Status: RESOLVED → VERIFIED
Component: DOM: Core → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: