Bug 12401

Summary: Avoid unnecessary allocations in CSS
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ejalbert
Priority: P2 Keywords: InRadar
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
Nate's patch darin: review+

Beth Dakin
Reported 2007-01-24 16:54:35 PST
From <rdar://problem/4946877> * SUMMARY Patch attached which avoids several unnecessary allocations, cutting down on time in malloc and free. 1. css/MediaQueryEvaluator.cpp, css/MediaQueryEvaluator.h, css/cssstyleselector.cpp Add a special method to the MediaQueryEvaluator class to avoid unnecessary turning a char * into a String object. 2. loader/Cache.cpp Don't turn a KURL's underlying String into another identical KURL. Or, even better, you could change the prototype to createResource to just take a String& instead of a KURL& and pass the url.url() to that, which is what createResource really wants to be doing anyway (since it only ever uses the String), but is no less work.
Attachments
Nate's patch (2.13 KB, patch)
2007-01-24 16:56 PST, Beth Dakin
darin: review+
Beth Dakin
Comment 1 2007-01-24 16:56:00 PST
Created attachment 12655 [details] Nate's patch Here is the patch attached to the radar bug.
Darin Adler
Comment 2 2007-01-24 16:59:13 PST
Comment on attachment 12655 [details] Nate's patch Looks good. r=me
Maciej Stachowiak
Comment 3 2007-01-24 17:12:27 PST
I don't think change #2 will actually save any allocations, since creating a KURL from the DeprecatedString inside another KURL won't actually call malloc. It will needlessly reparse it though, so still a good change. This needs a ChangeLog and should be run through regression tests.
Darin Adler
Comment 4 2007-01-26 09:29:47 PST
I ran the regression tests and wrote a change log. Committed revision 19156.
Note You need to log in before you can comment on or make changes to this bug.