RESOLVED FIXED 32454
Refactor construction of simple strings to avoid string concatenation.
https://bugs.webkit.org/show_bug.cgi?id=32454
Summary Refactor construction of simple strings to avoid string concatenation.
Gavin Barraclough
Reported 2009-12-11 15:20:10 PST
Building strings through concatenation has a memory and performance cost – a memory cost since we must over-allocate the buffer to leave space to append into, and performance in that the string may still require reallocation (and thus copying during construction). Instead move the full construction to within a single function call (makeString), so that the arguments' lengths can be calculated and an appropriate sized buffer allocated before copying any characters.
Attachments
The patch (42.12 KB, patch)
2009-12-11 15:25 PST, Gavin Barraclough
oliver: review+
Gavin Barraclough
Comment 1 2009-12-11 15:25:16 PST
Created attachment 44713 [details] The patch
WebKit Review Bot
Comment 2 2009-12-11 15:26:05 PST
Attachment 44713 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 JavaScriptCore/runtime/UString.h:547: This { should be at the end of the previous line [whitespace/braces] [4] JavaScriptCore/runtime/UString.h:570: This { should be at the end of the previous line [whitespace/braces] [4] JavaScriptCore/runtime/UString.h:593: This { should be at the end of the previous line [whitespace/braces] [4] Total errors found: 3
Oliver Hunt
Comment 3 2009-12-11 15:30:37 PST
Comment on attachment 44713 [details] The patch rme=
Gavin Barraclough
Comment 4 2009-12-11 15:34:22 PST
Transmitting file data ................. Committed revision 52028.
Note You need to log in before you can comment on or make changes to this bug.