RESOLVED FIXED 152203
CachedScript could have a copy-free path for all-ASCII scripts.
https://bugs.webkit.org/show_bug.cgi?id=152203
Summary CachedScript could have a copy-free path for all-ASCII scripts.
Andreas Kling
Reported 2015-12-11 16:52:27 PST
If a script resource consists of nothing but ASCII characters, we could have CachedScript::script() return a String that just wraps the internal SharedBuffer's contents instead of dragging the data through TextDecoder.
Attachments
Patch for EWS (31.80 KB, patch)
2015-12-12 13:58 PST, Andreas Kling
no flags
Patch (32.46 KB, patch)
2015-12-12 22:17 PST, Andreas Kling
no flags
Patch (32.57 KB, patch)
2015-12-13 01:26 PST, Andreas Kling
koivisto: review+
Patch for landing (32.71 KB, patch)
2015-12-13 11:09 PST, Andreas Kling
no flags
Andreas Kling
Comment 1 2015-12-12 13:58:02 PST
Created attachment 267242 [details] Patch for EWS
Andreas Kling
Comment 2 2015-12-12 22:17:50 PST
Andreas Kling
Comment 3 2015-12-13 01:26:51 PST
Antti Koivisto
Comment 4 2015-12-13 01:45:01 PST
Comment on attachment 267256 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=267256&action=review Nice, r=me > Source/WebCore/loader/cache/CachedScript.h:65 > + enum ASCIIResourceOptimizationState { Unknown, Optimized, NotOptimized }; > + ASCIIResourceOptimizationState m_ASCIIOptimizationState { Unknown }; Maybe this could be more explicit about what "Optimized" means? Something along the lines of DataAndDecodedStringHaveSameBytes.
Andreas Kling
Comment 5 2015-12-13 11:09:10 PST
Created attachment 267265 [details] Patch for landing
WebKit Commit Bot
Comment 6 2015-12-13 12:03:49 PST
Comment on attachment 267265 [details] Patch for landing Clearing flags on attachment: 267265 Committed r194017: <http://trac.webkit.org/changeset/194017>
WebKit Commit Bot
Comment 7 2015-12-13 12:03:55 PST
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 8 2015-12-13 13:31:17 PST
Comment on attachment 267256 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=267256&action=review > Source/WebCore/loader/cache/CachedScript.cpp:74 > + return encoding == "UTF-8" || encoding == "ISO-8859-1" || encoding == "ASCII"; This seems to be way too conservative. Almost all encodings would answer yes for this. Pretty much everything except for UTF-16 and UTF-32, and I think TextEncoding can answer this question. It's strange to be asking this given just a string rather than TextEncoding.
Note You need to log in before you can comment on or make changes to this bug.