Bug 57843

Summary: Switch from Vector<UChar> to StringBuilder in dom/
Product: WebKit Reporter: Nikolas Zimmermann <zimmermann>
Component: WebCore Misc.Assignee: Nikolas Zimmermann <zimmermann>
Status: RESOLVED FIXED    
Severity: Normal CC: kling
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on: 58420    
Bug Blocks:    
Attachments:
Description Flags
Patch darin: review+

Description Nikolas Zimmermann 2011-04-05 07:22:14 PDT
As discussed in bug 56099, we should deploy StringBuilder usage in WebCore where possible.
This bug addresses Source/WebCore/dom.
Comment 1 Nikolas Zimmermann 2011-04-05 07:24:13 PDT
Created attachment 88225 [details]
Patch
Comment 2 Andreas Kling 2011-04-08 10:44:55 PDT
Comment on attachment 88225 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88225&action=review

> Source/WebCore/dom/DatasetDOMStringMap.cpp:124
> +            builder.append(toASCIILower(characters[i]));

Why characters[i] and not character? And why do you need the local regardless?
Comment 3 Nikolas Zimmermann 2011-04-08 23:31:09 PDT
Comment on attachment 88225 [details]
Patch

Sorry Andreas, I should have removed r? before. As discussed with Maciej, he prefers to optimize operator+ instead of having to change all callsites that append just 2 strings. I'll look into that.
Comment 4 Nikolas Zimmermann 2011-05-12 07:58:12 PDT
Comment on attachment 88225 [details]
Patch

Marking patch for review again, now that 58420 is fixed. This patch is unrelated to the String operator+ optimization, and should go in as well.
Maciej, can you have another look please?
Vector<UChar> -> StringBuilder should be fine.
Comment 5 Darin Adler 2011-05-12 09:45:20 PDT
Comment on attachment 88225 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=88225&action=review

>> Source/WebCore/dom/DatasetDOMStringMap.cpp:124
>> +            builder.append(toASCIILower(characters[i]));
> 
> Why characters[i] and not character? And why do you need the local regardless?

I agree with both comments. There is little benefit to using the local, but if we do use it we should use it in all three places.
Comment 6 Nikolas Zimmermann 2011-05-16 03:58:46 PDT
Thanks Darin, landed in r86553. Adressed Darin/Andreas comment in r86555 regarding the local variable.