RESOLVED FIXED 179907
Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
https://bugs.webkit.org/show_bug.cgi?id=179907
Summary Reduce WTF::String operations that do unnecessary Unicode operations instead ...
Darin Adler
Reported 2017-11-20 19:40:00 PST
Reduce WTF::String operations that do unnecessary Unicode operations instead of ASCII
Attachments
Patch (399.19 KB, patch)
2017-11-20 22:04 PST, Darin Adler
no flags
Patch (409.84 KB, patch)
2017-11-20 22:38 PST, Darin Adler
no flags
Patch (411.50 KB, patch)
2017-11-20 22:53 PST, Darin Adler
no flags
Patch (415.11 KB, patch)
2017-11-21 04:47 PST, Darin Adler
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (901.16 KB, application/zip)
2017-11-21 06:07 PST, EWS Watchlist
no flags
Patch (421.56 KB, patch)
2017-11-21 06:40 PST, Darin Adler
no flags
Patch (426.56 KB, patch)
2017-11-21 08:36 PST, Darin Adler
sam: review+
Darin Adler
Comment 1 2017-11-20 22:04:00 PST Comment hidden (obsolete)
EWS Watchlist
Comment 2 2017-11-20 22:07:35 PST Comment hidden (obsolete)
Darin Adler
Comment 3 2017-11-20 22:38:49 PST Comment hidden (obsolete)
EWS Watchlist
Comment 4 2017-11-20 22:40:54 PST Comment hidden (obsolete)
Darin Adler
Comment 5 2017-11-20 22:53:39 PST Comment hidden (obsolete)
EWS Watchlist
Comment 6 2017-11-20 22:57:00 PST Comment hidden (obsolete)
Darin Adler
Comment 7 2017-11-21 04:47:57 PST Comment hidden (obsolete)
EWS Watchlist
Comment 8 2017-11-21 04:50:37 PST Comment hidden (obsolete)
EWS Watchlist
Comment 9 2017-11-21 06:07:13 PST Comment hidden (obsolete)
EWS Watchlist
Comment 10 2017-11-21 06:07:14 PST Comment hidden (obsolete)
Darin Adler
Comment 11 2017-11-21 06:40:11 PST Comment hidden (obsolete)
EWS Watchlist
Comment 12 2017-11-21 06:43:42 PST Comment hidden (obsolete)
Darin Adler
Comment 13 2017-11-21 08:36:21 PST
EWS Watchlist
Comment 14 2017-11-21 08:39:50 PST
Attachment 327412 [details] did not pass style-queue: ERROR: Source/WTF/wtf/text/StringImpl.h:1060: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WTF/wtf/text/WTFString.h:427: More than one command on the same line [whitespace/newline] [4] ERROR: Source/WTF/wtf/text/WTFString.h:432: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 3 in 136 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 15 2017-11-21 12:45:10 PST
Comment on attachment 327412 [details] Patch OK, working well, compiling and passing tests everywhere, and ready for review now.
Darin Adler
Comment 16 2017-11-22 10:10:06 PST
No pressure, Sam, but I did notice you reviewing another patch.
Sam Weinig
Comment 17 2017-11-22 17:40:04 PST
Comment on attachment 327412 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327412&action=review > Source/JavaScriptCore/dfg/DFGDesiredIdentifiers.cpp:84 > + ASSERT(result->refCount()); Does this still do the right thing for immortal strings? > Source/WebCore/page/SecurityOrigin.cpp:333 > static bool isFeedWithNestedProtocolInHTTPFamily(const URL& url) > { I wonder if we still need this function, given we don't really display feed: urls anymore. > Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp:95 > + auto key = header.left(splitPosition).stripWhiteSpace(); Can this be done as a single additional allocation by doing something like (the admittedly much longer): auto key = StringView { header }.left(splitPosition).stripLeadingAndTrailingMatchedCharacters(SpaceOrNewlinePredicate { }).toString(); > Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp:112 > - auto httpVersionEndPosition = statusLine.find(" "); > + auto httpVersionEndPosition = statusLine.find(' '); I wonder if we can make this a compile error, by statically asserting that a literal string is longer than one character long.
Darin Adler
Comment 18 2017-11-23 09:09:32 PST
Comment on attachment 327412 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327412&action=review >> Source/JavaScriptCore/dfg/DFGDesiredIdentifiers.cpp:84 >> + ASSERT(result->refCount()); > > Does this still do the right thing for immortal strings? Well, kind of; it will return false for an immortal string if absolutely no one is holding a reference to it. I guess I can roll this back because it was more correct the old way. But it annoys me to have a function that is literally used only in these two places in this one file and only for an assertion. >> Source/WebCore/page/SecurityOrigin.cpp:333 >> { > > I wonder if we still need this function, given we don't really display feed: urls anymore. Good point; would be great to figure that out and remove this. You brought this into the world, maybe you should take it out? >> Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp:95 >> + auto key = header.left(splitPosition).stripWhiteSpace(); > > Can this be done as a single additional allocation by doing something like (the admittedly much longer): > > auto key = StringView { header }.left(splitPosition).stripLeadingAndTrailingMatchedCharacters(SpaceOrNewlinePredicate { }).toString(); Yes, and also it should be dealing with HTTP’s definition of whitespace, not the general purpose whitespace definition from Unicode. I decided to leave this alone for now since it’s in the curl-specific code. >> Source/WebCore/platform/network/curl/ResourceResponseCurl.cpp:112 >> + auto httpVersionEndPosition = statusLine.find(' '); > > I wonder if we can make this a compile error, by statically asserting that a literal string is longer than one character long. I bet we can.
Darin Adler
Comment 19 2017-11-23 09:32:49 PST
Radar WebKit Bug Importer
Comment 20 2017-11-23 09:34:20 PST
Carlos Alberto Lopez Perez
Comment 21 2017-11-23 16:35:40 PST
Note You need to log in before you can comment on or make changes to this bug.