Bug 10817 - <pattern> should not use CGLayer (30% of our time drawing patterns in large SVG)
Summary: <pattern> should not use CGLayer (30% of our time drawing patterns in large SVG)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P4 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-11 19:28 PDT by Eric Seidel (no email)
Modified: 2006-12-21 04:04 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2006-09-11 19:28:34 PDT
<pattern> should not use CGLayer (30% of our time drawing patterns in large SVG)

This was plan.svg

(Interesting to note Mozilla's analysis thereof: http://weblogs.mozillazine.org/tor/archives/2006/04/)

A much better solution would be to raster the pattern down to a bitmap, thus allowing CG to just blit the bitmap every time the pattern is used.
Comment 1 Eric Seidel (no email) 2006-09-11 19:31:04 PDT
I have a shark file if someone wants to see it.  Unfortunately it's 2.7 MB.

	0.1%	69.9%	WebCore	WebCore::RenderPath::paint(WebCore::RenderObject::PaintInfo&, int, int)	
	0.0%	57.2%	WebCore	WebCore::KRenderingPaintServerPatternQuartz::draw(WebCore::KRenderingDeviceContext*, WebCore::RenderPath const*, WebCore::KCPaintTargetType) const	
	0.0%	57.1%	WebCore	WebCore::KRenderingPaintServerPatternQuartz::renderPath(WebCore::KRenderingDeviceContext*, WebCore::RenderPath const*, WebCore::KCPaintTargetType) const	
	27.1%	57.1%	WebCore	WebCore::KRenderingPaintServerQuartzHelper::fillPath(CGContext*, WebCore::RenderPath const*)	
	30.0%	30.0%	WebCore	WebCore::patternCallback(void*, CGContext*)	
	0.0%	0.0%	WebCore	WebCore::KCanvasImageQuartz::cgLayer()	


Comment 2 Nikolas Zimmermann 2006-12-19 12:04:53 PST
Pattterns don't use CGLayer anymore in ToT.
Comment 3 Eric Seidel (no email) 2006-12-21 03:50:13 PST
I'm not sure this truly counts as resolved.  We've just shifted the timing to a different CG call now.

I wrote a mail about this to several webkit folks:

1.  50% of the time is spent filling paths.  Looking at the sample, it's all down in CG pattern code.  I originally suspected that this was due to webkit blowing away CGPattern-related caches every time draw by destroying the CGPattern object in teardown().  (Ideally WebKit should cache the CGPattern object on the SVGPaintServerPatternCg instance, and only regenerate it when the paintserver changes.)  But I made a quick hack to keep m_pattern around, and yet I still see 50% of the time spent filling paths.  WebKit may still be blowing away those caches more often that I expect (by resetting the tile, or destroying the paintserver), or something else could be wrong.  Oliver might want to chat with Andrew B.

We (I) can file a separate bug to track such if you like.
Comment 4 Eric Seidel (no email) 2006-12-21 04:04:54 PST
I filed bug 10817 as a followup.