Bug 101409 - Make Document::renderer faster by using the cached ptr for RenderView
Summary: Make Document::renderer faster by using the cached ptr for RenderView
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Elliott Sprehn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-06 16:29 PST by Elliott Sprehn
Modified: 2012-11-06 19:32 PST (History)
2 users (show)

See Also:


Attachments
Patch (3.96 KB, patch)
2012-11-06 16:41 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Sprehn 2012-11-06 16:29:58 PST
Make Document::renderer faster by using the cached ptr for RenderView
Comment 1 Elliott Sprehn 2012-11-06 16:41:47 PST
Created attachment 172677 [details]
Patch
Comment 2 Elliott Sprehn 2012-11-06 16:59:23 PST
In pondering this patch I wonder if it's better to just change callers to use document()->renderView() and make Document::renderer private? 

That avoids all this casting stuff and the out of line method, but it means changing many more files. As an advantage it would also stop people from doing the silliness that's in several places where they think document()->renderer() != document()->renderer()->view(), the only downside is that it means including RenderView.h whenever you want to access the renderer on the document.

Any opinion on this Eric?
Comment 3 Eric Seidel (no email) 2012-11-06 17:12:57 PST
So this is just reverting your previous change?
Comment 4 Elliott Sprehn 2012-11-06 17:47:36 PST
(In reply to comment #3)
> So this is just reverting your previous change?

Only partly, my previous change made renderView() return a pointer stored in Document skipping the RareData union stuff in Node::renderer().

so without this patch:

Document::renderer() => Still goes through Node::renderer() and checks the hasRareData() and stuff.
Document::renderView() => Direct ptr access without the conditional

With this patch:

Document::renderer() => Returns m_renderer and skips the union hasRareData logic.
Document::renderView() => Also kips the logic, but needs the cast and to be in RenderView.h

My other alternative is:

Document::renderer() is private and just calls the "slow" Node::renderer()
Change all callers of document()->renderer() to do document()->renderView()

That last option means changing tons of files, but is more explicit at least.
Comment 5 Eric Seidel (no email) 2012-11-06 18:07:29 PST
Comment on attachment 172677 [details]
Patch

OK.
Comment 6 WebKit Review Bot 2012-11-06 19:31:59 PST
Comment on attachment 172677 [details]
Patch

Clearing flags on attachment: 172677

Committed r133711: <http://trac.webkit.org/changeset/133711>
Comment 7 WebKit Review Bot 2012-11-06 19:32:02 PST
All reviewed patches have been landed.  Closing bug.