Bug 59967

Summary: Avoid wasted cycles updating paths when popping the context stack
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: CanvasAssignee: Simon Fraser (smfr) <simon.fraser>
Severity: Normal CC: mdelaney7, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Description Flags
Patch mitz: review+

Description Simon Fraser (smfr) 2011-05-02 15:24:13 PDT
CanvasRenderingContext2D::restore() does m_path.transform(state().m_transform); which is a waste of cycles if the path is empty, or the transform is identity.
Comment 1 Simon Fraser (smfr) 2011-05-02 15:49:42 PDT
Created attachment 91995 [details]
Comment 2 Matthew Delaney 2011-05-02 16:06:54 PDT
I wonder if putting isEmpty first in the check might make these paths even a little faster. isIdentity() looks at a handful of values on the matrix whereas isEmpty should be checking just a single count variable (platform dependent of course though).
Comment 3 Simon Fraser (smfr) 2011-05-02 16:19:04 PDT