Bug 53871 - Refactor Font::normalizeSpaces() to avoid an extra String copy.
Summary: Refactor Font::normalizeSpaces() to avoid an extra String copy.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-06 07:23 PST by Andreas Kling
Modified: 2011-02-06 08:22 PST (History)
1 user (show)

See Also:


Attachments
Proposed patch (7.71 KB, patch)
2011-02-06 07:24 PST, Andreas Kling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2011-02-06 07:23:41 PST
Font::normalizeSpaces() could take an UChar*/length pair as arguments instead of a String.
All call sites create a temporary String for passing to this function, and there is some cleverness in normalizeSpaces() to reuse that String if no spaces are normalized.
We should let normalizeSpaces() do the String creation which means we'll always make 1 String instead of 1 in the best case and 2 in the worst case.
Comment 1 Andreas Kling 2011-02-06 07:24:48 PST
Created attachment 81402 [details]
Proposed patch
Comment 2 Dirk Schulze 2011-02-06 08:17:49 PST
Comment on attachment 81402 [details]
Proposed patch

r=me
Comment 3 Andreas Kling 2011-02-06 08:22:31 PST
Comment on attachment 81402 [details]
Proposed patch

Clearing flags on attachment: 81402

Committed r77768: <http://trac.webkit.org/changeset/77768>
Comment 4 Andreas Kling 2011-02-06 08:22:39 PST
All reviewed patches have been landed.  Closing bug.