[Webkit-unassigned] [Bug 63330] New: Concatenating wide strings and WTF::Strings using operator+ is suboptimal on MSVC

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jun 24 09:52:54 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=63330

           Summary: Concatenating wide strings and WTF::Strings using
                    operator+ is suboptimal on MSVC
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Web Template Framework
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: aroben at apple.com
                CC: mjs at apple.com, darin at apple.com, zimmermann at kde.org


The following code:

String color("brown");
String workEthic("lazy");
String result = L"The quick " + color + L" fox jumped over the " + workEthic + L" dogs";

...doesn't behave in an optimal way. The optimal behavior would be for the + expressions to build up a StringAppend object, and only to convert to a String at the very end. What actually happens is:

1. L"The quick " is converted to a String
2. (String(L"The quick ") + color) is evaluated, resulting in a StringAppend object
3. StringAppend::operator String() is called
4. (String(L"The quick brown") + L" fox jumped over the ") is evaluated, resulting in a StringAppend object
5. StringAppend::operator String() is called

...and so on.

You can see that each concatenation is being converted to a String before the next concatenation occurs. It also shouldn't be necessary for the first wide string to be converted to a String.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list