WTF::String is supposed to be immutable, but createUninitialized() allows callers to hang on to a non-const reference to the underlying data buffer. Some of these usages could be replaced by StringBuilder.
Created attachment 104219 [details] Patch
If anyone has suggestions for performance benchmark tests to run before submitting, please comment.
PerformanceTests/Parser has a good test for the html parser. I'm not sure if that test hits these codepaths or not.
(In reply to comment #3) > PerformanceTests/Parser has a good test for the html parser. I'm not sure if that test hits these codepaths or not. Numbers from html-parser.html look similar before/after applying my patch. Before patch: avg 1605.3 median 1604 stdev 9.935290634903437 min 1594 max 1629 After patch: avg 1595.1 median 1592 stdev 6.579513659838393 min 1589 max 1609
Comment on attachment 104219 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=104219&action=review > Source/WebCore/html/parser/HTMLSourceTracker.cpp:59 > + int length = token.endIndex() - token.startIndex(); int => size_t probably
There shouldn't be any perf impact. ReserveCapacity effectively does the same thing by pre-allocating the buffer.
Comment on attachment 104219 [details] Patch Clearing flags on attachment: 104219 Committed r93281: <http://trac.webkit.org/changeset/93281>
All reviewed patches have been landed. Closing bug.