RESOLVED CONFIGURATION CHANGED 19368
Extremely slow parsing of deeply nested divs
https://bugs.webkit.org/show_bug.cgi?id=19368
Summary Extremely slow parsing of deeply nested divs
Michael A. Puls II
Reported 2008-06-03 04:22:50 PDT
WebKit-SVN-r34278 with Safari Win32 3.1.1(525.17) Parsing ~15840 divs deep takes a long time in Webkit. On a PIII 733MHz, Opera 9.5 (latest snapshot) and FF3 (latest trunk) take around 1.5 to 2 seconds to parse. Webkit takes ~66 seconds. Seems like there's room for optimization. Will attach example.
Attachments
Example (170.16 KB, text/html)
2008-06-03 04:23 PDT, Michael A. Puls II
no flags
Michael A. Puls II
Comment 1 2008-06-03 04:23:27 PDT
Created attachment 21474 [details] Example
mitz
Comment 2 2008-06-03 09:26:20 PDT
(In reply to comment #0) > On a PIII 733MHz, Opera 9.5 (latest snapshot) and FF3 (latest trunk) take > around 1.5 to 2 seconds to parse. Webkit takes ~66 seconds. Opera 9.50 beta constructs a DOM tree only about 500 levels deep; Firefox 3.0b4 caps at around 200.
Michael A. Puls II
Comment 3 2008-06-03 14:06:09 PDT
(In reply to comment #2) > (In reply to comment #0) > > On a PIII 733MHz, Opera 9.5 (latest snapshot) and FF3 (latest trunk) take > > around 1.5 to 2 seconds to parse. Webkit takes ~66 seconds. > > Opera 9.50 beta constructs a DOM tree only about 500 levels deep; Firefox 3.0b4 > caps at around 200. Confirmed and it seems Webkit caps at around 1024. What's actually happening here? document.getElementsByTagName("div").length reports all 15840 divs. Are they somehow flattened during parsing so they don't run so deep?
Ahmad Saleem
Comment 4 2022-08-11 10:16:22 PDT
I think browsers in general are well-optimised and CPU architectures have evolved to an extent where these div cases does not lead to any crash or parsing time consumption. In all browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5 using M1 Pro), this test case load instantly and in Console using - document.getElementsByTagName("div").length, it shows 15840 for everyone. rniwa@webkit.org & ap@webkit.org - Is there something needed here, or we can mark it as "RESOLVED CONFIGURATION CHANGED" or "RESOLVED WONTFIX"?
Ryosuke Niwa
Comment 5 2022-08-11 11:51:27 PDT
This doesn't seem that slow to me now.
Note You need to log in before you can comment on or make changes to this bug.