Bug 57843 - Switch from Vector<UChar> to StringBuilder in dom/
Summary: Switch from Vector<UChar> to StringBuilder in dom/
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: Nikolas Zimmermann
URL:
Keywords:
Depends on: 58420
Blocks:
  Show dependency treegraph
 
Reported: 2011-04-05 07:22 PDT by Nikolas Zimmermann
Modified: 2011-05-16 03:58 PDT (History)
1 user (show)

See Also:


Attachments
Patch (5.95 KB, patch)
2011-04-05 07:24 PDT, Nikolas Zimmermann
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.