Bug 59967 - Avoid wasted cycles updating paths when popping the context stack
Summary: Avoid wasted cycles updating paths when popping the context stack
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: All OS X 10.5
: P2 Normal
Assignee: Simon Fraser (smfr)
Depends on:
Reported: 2011-05-02 15:24 PDT by Simon Fraser (smfr)
Modified: 2011-05-02 16:19 PDT (History)
2 users (show)

See Also:

Patch (1.56 KB, patch)
2011-05-02 15:49 PDT, Simon Fraser (smfr)
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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