| Summary: | [Mac] Optimize cookiesForDOM() by filtering and serializing cookies in a single pass | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||
| Component: | DOM | Assignee: | Chris Dumez <cdumez> | ||||||||
| Status: | RESOLVED FIXED | ||||||||||
| Severity: | Enhancement | CC: | commit-queue | ||||||||
| Priority: | P2 | ||||||||||
| Version: | 528+ (Nightly build) | ||||||||||
| Hardware: | Mac | ||||||||||
| OS: | Unspecified | ||||||||||
| Attachments: |
|
||||||||||
|
Description
Chris Dumez
2014-10-19 18:33:59 PDT
Created attachment 240091 [details]
Patch
Created attachment 240092 [details]
Patch
Comment on attachment 240092 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=240092&action=review > Source/WebCore/platform/network/mac/CookieJarMac.mm:88 > + cookiesBuilder.append(String([cookie name])); If performance is enough of an issue here, we should consider coming up with a refinement to StringBuilder that doesn’t require allocating a new String for each NSString. > Source/WebCore/platform/network/mac/CookieJarMac.mm:92 > + if (cookie != lastCookie) > + cookiesBuilder.appendLiteral("; "); I think a cleaner way to write this is to put at the beginning of the loop: if (!cookiesBuilder.isEmpty()) cookiesBuilder.appendLiteral("; "); Then we don’t need lastCookie. Comment on attachment 240092 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=240092&action=review >> Source/WebCore/platform/network/mac/CookieJarMac.mm:88 >> + cookiesBuilder.append(String([cookie name])); > > If performance is enough of an issue here, we should consider coming up with a refinement to StringBuilder that doesn’t require allocating a new String for each NSString. Yes, this is a bit unfortunate. However, at the moment, according to the profile (see bottom of the bug description), the impact seems fairly minimal: 2.0ms 0.3% 0.0 WTF::String::String(NSString*) >> Source/WebCore/platform/network/mac/CookieJarMac.mm:92 >> + cookiesBuilder.appendLiteral("; "); > > I think a cleaner way to write this is to put at the beginning of the loop: > > if (!cookiesBuilder.isEmpty()) > cookiesBuilder.appendLiteral("; "); > > Then we don’t need lastCookie. Oh right, better indeed, thanks. Created attachment 240097 [details]
Patch
Comment on attachment 240097 [details] Patch Clearing flags on attachment: 240097 Committed r174877: <http://trac.webkit.org/changeset/174877> All reviewed patches have been landed. Closing bug. This caused bug 138053. |