Bug 14742 - Document::recalcStyle(Force) called for every updateStyleIgnorePendingStylesheets while waiting for stylesheets
Summary: Document::recalcStyle(Force) called for every updateStyleIgnorePendingStylesh...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://www.bbc.co.uk/history/historic...
Keywords: InRadar
: 14839 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-07-23 23:28 PDT by mitz
Modified: 2007-08-09 20:56 PDT (History)
1 user (show)

See Also:


Attachments
Patch (not for now) (2.82 KB, patch)
2007-07-23 23:30 PDT, mitz
no flags Details | Formatted Diff | Diff
Patch (for now) (2.14 KB, patch)
2007-08-03 08:07 PDT, mitz
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2007-07-23 23:28:31 PDT
If stylesheets have not yet loaded, updateStyleIgnorePendingStylesheets() will call updateStyleSelector() which calls recalcStyle(Force).

This is *not* a regression from the m_didCalculateStyleSelector patch (which fixed a Yahoo! Mail crash), but still would be nice to fix at some point. Basically you need updateStyleSelector() to only set a flag and postpone the update until later when you need it.
Comment 1 mitz 2007-07-23 23:30:58 PDT
Created attachment 15656 [details]
Patch (not for now)
Comment 2 mitz 2007-08-01 00:26:53 PDT
See also bug 14839.
Comment 3 David Kilzer (:ddkilzer) 2007-08-01 06:56:07 PDT
*** Bug 14839 has been marked as a duplicate of this bug. ***
Comment 4 David Kilzer (:ddkilzer) 2007-08-01 06:56:49 PDT
<rdar://problem/5376306>
Comment 5 mitz 2007-08-01 11:32:05 PDT
(In reply to comment #3)
> *** Bug 14839 has been marked as a duplicate of this bug. ***

Raising priority to P2 since the bug affects a popular website. Dave, could you check if this is a regression from the Safari/WebKit that shipped with Tiger?
Comment 6 David Kilzer (:ddkilzer) 2007-08-01 15:10:43 PDT
(In reply to comment #5)
> Raising priority to P2 since the bug affects a popular website. Dave, could you
> check if this is a regression from the Safari/WebKit that shipped with Tiger?

It is a slight regression for the Safari 3 Public Beta v. 3.0.3 on Tiger:

Using a 1.5 GHz PowerBook G4:

Using Mac OS X 10.4.10 (8R218) Tiger:
- Safari 2.0.4 (419.3) with its original WebKit:  ~8 seconds
- Safari 3 Public Beta 3.0.3 (522.12.1) with its original WebKit: ~10 seconds

However, Safari on Leopard is slightly better than Safari 2.0.4 on Tiger.

Comment 7 David Kilzer (:ddkilzer) 2007-08-02 06:44:51 PDT
On the same hardware on Mac OS X 10.4.10 (8R218) using Safari 3 Public Beta v. 3.0.3 (522.12.1) with a DEBUG BUILD of ToT Webkit r24803, the page loads in ~2 seconds.

Testing methodology:

1. Launch Safari/WebKit.
2. Open the page once (untimed).
3. Hit Cmd-R and time the load.
4. Repeat Step 3 five or six times to get a ballpark figure.

Comment 8 mitz 2007-08-03 08:00:51 PDT
(In reply to comment #7)
> On the same hardware on Mac OS X 10.4.10 (8R218) using Safari 3 Public Beta v.
> 3.0.3 (522.12.1) with a DEBUG BUILD of ToT Webkit r24803, the page loads in ~2
> seconds.

Just to make sure I understood, a debug build of r24803 is almost 5 times faster than the beta?
Comment 9 mitz 2007-08-03 08:07:05 PDT
Created attachment 15818 [details]
Patch (for now)

This is a very pinpointed and conservative fix.

I think in the long run, Document::updateStyleSelector() should be replaced with a function that just sets a "style selector dirty" flag, and Document::styleSelector() should lazily update the style selector as needed. That is worth doing even if JavaScript becomes interruptible, because it will coalesce style updates.
Comment 10 David Kilzer (:ddkilzer) 2007-08-03 08:21:07 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > On the same hardware on Mac OS X 10.4.10 (8R218) using Safari 3 Public Beta v.
> > 3.0.3 (522.12.1) with a DEBUG BUILD of ToT Webkit r24803, the page loads in ~2
> > seconds.
> 
> Just to make sure I understood, a debug build of r24803 is almost 5 times
> faster than the beta?

Correct.
Comment 11 Dave Hyatt 2007-08-07 12:58:21 PDT
Comment on attachment 15818 [details]
Patch (for now)

r=me
Comment 12 Mark Rowe (bdash) 2007-08-09 20:56:46 PDT
Landed in r24973.