Closed
Bug 196557
Opened 22 years ago
Closed 21 years ago
[FIX]Lots of empty <style> tags slow rendering down [100% processor utilization]
Categories
(Core :: CSS Parsing and Computation, defect, P1)
Core
CSS Parsing and Computation
Tracking
()
VERIFIED
FIXED
mozilla1.5alpha
People
(Reporter: waltergarcia, Assigned: bzbarsky)
References
()
Details
(Keywords: perf, testcase)
Attachments
(3 files, 2 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
text/html
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030308 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030308 The right column at http://theburritosband.vivelared.com/index.php, wich uses Javascript to scroll some links makes Mozilla1.3 to use 100% of cpu and then hangs. I had the same problem with Phoenix0.5 (1.3) but it only lasted a seconds, after that the cpu utilization used to go down to normal cpu use. Reproducible: Always Steps to Reproduce: 1. Visit http://theburritosband.vivelared.com/index.php 2. Watch your CPU utilization 3. I have tested it on Linux and Windows2K.
Comment 1•22 years ago
|
||
wfm with win2k build 20030303.. (no hang) why should this be a blocker ? -> critical
Severity: blocker → critical
Updated•22 years ago
|
Flags: blocking1.3? → blocking1.3-
Comment 2•22 years ago
|
||
I see the problem with Mozilla trunk binary 2003022808 on WinNT. My CPU is 100% for almost a minute while the page loads. The browser doesn't hang: one can interact with it, but only slowly. This does not appear to be a JavaScript problem. The site is very light on JavaScript: I see hardly any. The marquees are not created via JavaScript, but by <marquee> elements in HTML: <MARQUEE behavior= "scroll" align= "center" direction= "up" height="120" scrollamount= "2" scrolldelay= "90" onmouseover='this.stop()' onmouseout='this.start()'> <MARQUEE behavior= "scroll" align= "center" direction= "up" height="420" scrollamount= "2" scrolldelay= "20" onmouseover='this.stop()' onmouseout='this.start()'> I did some reductions via Composer and found that removing some of the content to the left of the marquees, or above them, resulted in a much faster load time. So perhaps it's a reflow issue of some sort? Reassigning to Layout for further analysis -
Assignee: rogerl → other
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → Layout
Ever confirmed: true
Keywords: perf
QA Contact: pschwartau → ian
Updated•22 years ago
|
Priority: -- → P2
Target Milestone: --- → Future
Comment 3•22 years ago
|
||
the page contains lots of <STYLE="text-decoration: none"> removing them solves the problem -> parser
Assignee: other → harishd
Component: Layout → Parser
QA Contact: ian → dsirnapalli
Summary: Javascript: 100% processor utilization, and then hangs → lots of <STYLE="text-decoration: none"> slows rendering down [100% processor utilization]
![]() |
Assignee | |
Comment 4•22 years ago
|
||
What does this have to do with parser? You should try profiling the page before making decisions like that; at a guess, what's going on here is that we add lots of style sheets (one per <style> element) and each time we add a sheet we have to reresolve style all over. Perhaps we could pass along some boolean in StyleSheetAdded saying whether the sheet actually has any rules? Or the presshell could do that check before blowing away style data...
Assignee: harishd → dbaron
Component: Parser → Style System
QA Contact: dsirnapalli → ian
![]() |
Assignee | |
Comment 5•22 years ago
|
||
![]() |
Assignee | |
Updated•22 years ago
|
Priority: P2 → --
Target Milestone: Future → ---
Comment 6•22 years ago
|
||
note: there are lots of open <style=> and <font> tags. Removing some of them solves the problem
Updated•22 years ago
|
Summary: lots of <STYLE="text-decoration: none"> slows rendering down [100% processor utilization] → Lots of open tags (<font>, <style="text-decoration: none">) slows rendering down [100% processor utilization]
![]() |
Assignee | |
Comment 7•22 years ago
|
||
Total hit count: 1180 Of these 1034 happen under PresShell::ReconstructStyleData(int). 1065 hits happen under ReResolveStyleContext; the top of the flat profile is: Total hit count: 1180 Count %Total Function Name 82 6.9 SelectorMatches(RuleProcessorData &, nsCSSSelector *, int, nsIAtom *, signed char) 55 4.7 FrameManager::ReResolveStyleContext(nsIPresContext *, nsIFrame *, nsIContent *, int, nsIAtom *, nsStyleChangeList &, nsChangeHint, nsChangeHint &) 43 3.6 RuleHash::EnumerateAllRules(int, nsIAtom *, nsIAtom *, nsVoidArray &, void (*)(nsICSSStyleRule *, void *), void *) 34 2.9 RuleProcessorData::RuleProcessorData(nsIPresContext *, nsIContent *, nsRuleWalker *, nsCompatibility *) 33 2.8 PL_DHashTableOperate 26 2.2 nsCOMPtr_base::begin_assignment(void) 26 2.2 SearchTable 22 1.9 nsCOMPtr_base::~nsCOMPtr_base(void) 21 1.8 ContentEnumFunc(nsICSSStyleRule *, void *) Pretty much what you'd expect given the amount of time spent rebuilding the style context tree....
![]() |
Assignee | |
Comment 8•22 years ago
|
||
Comment on attachment 119596 [details] [diff] [review] possible patch, untested OK, this patch speeds up this testcase by a factor of 12 or so according to jprof (and "noticeably" according to wall clock). Also fixes a bug where we could incorrectly leave rulenodes in the tree when a style sheet got disabled...
Attachment #119596 -
Flags: superreview?(dbaron)
Attachment #119596 -
Flags: review?(dbaron)
![]() |
Assignee | |
Comment 9•22 years ago
|
||
Comment on attachment 119596 [details] [diff] [review] possible patch, untested The other option, of course, is to pass along in the notification itself whether the sheet contains any rules....
![]() |
Assignee | |
Comment 10•22 years ago
|
||
.
Assignee: dbaron → bzbarsky
OS: Windows 2000 → All
Priority: -- → P1
Hardware: PC → All
Summary: Lots of open tags (<font>, <style="text-decoration: none">) slows rendering down [100% processor utilization] → [FIX]Lots of empty <style> tags slow rendering down [100% processor utilization]
Target Milestone: --- → mozilla1.4beta
Comment 11•22 years ago
|
||
Great, can we get this into 1.4beta ?
Comment 12•21 years ago
|
||
I was actually thinking of relying on the rule tree GC (and perhaps tuning the parameters) and getting rid of the rule tree rebuilding code here. The explicit CSS stuff seems ugly -- how about a new method on nsIStyleSheet? (|HasRules|?)
![]() |
Assignee | |
Comment 13•21 years ago
|
||
Comment on attachment 119596 [details] [diff] [review] possible patch, untested The problem is not the ruletree rebuilding -- it's not rebuilt, in fact, since sheets are being added, not removed. The problem is the top-down reresolve of style on every single piece of content in the document. Yes, HasRules is probably a better idea; I'll do something like that once I get back to working on Moz.
Attachment #119596 -
Flags: superreview?(dbaron)
Attachment #119596 -
Flags: review?(dbaron)
![]() |
Assignee | |
Updated•21 years ago
|
Target Milestone: mozilla1.4beta → mozilla1.5alpha
Comment 14•21 years ago
|
||
I was just mentioning the rule tree rebuilding because I didn't see any reason to add more of it.
![]() |
Assignee | |
Comment 15•21 years ago
|
||
Oh, the second hunk. I see. Yeah, that's a good point.
![]() |
Assignee | |
Updated•21 years ago
|
Attachment #119596 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 16•21 years ago
|
||
![]() |
Assignee | |
Comment 17•21 years ago
|
||
Comment on attachment 126862 [details] [diff] [review] More ambitious patch David? What do you think?
Attachment #126862 -
Flags: superreview?(dbaron)
Attachment #126862 -
Flags: review?(dbaron)
Comment 18•21 years ago
|
||
Comment on attachment 126862 [details] [diff] [review] More ambitious patch >+NS_IMETHODIMP_(PRBool) >+CSSStyleSheetImpl::HasRules() const >+{ >+ if (!mInner || !mInner->mOrderedRules) { >+ return PR_FALSE; >+ } Why bother? StyleRuleCount does the same thing. >+ >+ PRInt32 count; >+ StyleRuleCount(count); >+ return count != 0; >+} >+NS_IMETHODIMP_(PRBool) >+HTMLCSSStyleSheetImpl::HasRules() const >+{ >+ return mFirstLineRule || mFirstLetterRule; > } This should unconditionally return true, because of inline style rules, and because the firstline and firstletter rules are allocated as needed. > NS_IMETHODIMP > PresShell::StyleSheetAdded(nsIDocument *aDocument, >+ >+ if (!applicable) { >+ return NS_OK; > } > >- return NS_OK; >+ if (!aStyleSheet->HasRules()) { >+ return NS_OK; >+ } how about: if (!applicable || !aStyleSheet->HasRules) { return NS_OK; } (and the same for StyleSheetRemoved) r+sr=dbaron
Attachment #126862 -
Flags: superreview?(dbaron)
Attachment #126862 -
Flags: superreview+
Attachment #126862 -
Flags: review?(dbaron)
Attachment #126862 -
Flags: review+
![]() |
Assignee | |
Comment 19•21 years ago
|
||
Attachment #126862 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 20•21 years ago
|
||
Checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•