RESOLVED WONTFIX 23050
Copying Fonts by value makes GraphicsContext::save() and restore() expensive
https://bugs.webkit.org/show_bug.cgi?id=23050
Summary Copying Fonts by value makes GraphicsContext::save() and restore() expensive
Simon Fraser (smfr)
Reported 2008-12-30 22:12:19 PST
I have a Shark sample (generated from the testcase in bug 19312) that shows that GraphicsContext::save() and restore() are pretty expensive; in this test. they take 11.7% and 23% of the entire sample (of which 87% is in painting). Focusing on GraphicsContext::restore(), GraphicsContext::operator= is 65%, including 58% from Font::operator=. Vector::removeLast is 19%, and restorePlatformState() is 14%. Of the Font::operator= cost, almost all is in the GlyphPageTreeNode hash table copy. Inside GraphicsContext::save(), 62% is in the Font constructor, and 22% is savePlatformState.
Attachments
Shark session (2.47 MB, application/octet-stream)
2009-01-01 19:08 PST, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2009-01-01 19:07:21 PST
Testcase in the URL field.
Simon Fraser (smfr)
Comment 2 2009-01-01 19:08:45 PST
Created attachment 26358 [details] Shark session
Simon Fraser (smfr)
Comment 3 2009-01-01 19:10:36 PST
My initial analysis was done on a debug build (stupid!). In a release build, things aren't nearly as bad. In the attached Shark profile of the testcase, GraphicsContext::restore() is 1.4%, and GraphicsContext::save() 0.6%. However, Font::operator= is still 39% of the time spent in GraphicsContext::restore(), so I think there's still a win to be had here.
Simon Fraser (smfr)
Comment 4 2009-01-01 19:27:44 PST
Simon Fraser (smfr)
Comment 5 2009-01-17 18:29:05 PST
Note You need to log in before you can comment on or make changes to this bug.