NEW 117781
Consider using String rope for XMLHttpRequest.responseText
https://bugs.webkit.org/show_bug.cgi?id=117781
Summary Consider using String rope for XMLHttpRequest.responseText
Ryosuke Niwa
Reported 2013-06-18 20:53:53 PDT
Consider merging https://chromium.googlesource.com/chromium/blink/+/3d7d1c4f000b6a955ca23a17aa1bee48e8c281b3 MLHttpRequest#responseText should use a rope Instead of building a flat WTF::String from XMLHttpRequest response data, we should build a v8::String rope. That way when web sites query the responseText field repeatedly, every query will share the same underlying data. This CL causes StringImpl::hashSlowCase to drop way down the CPU profile of reloading Mobile Gmail: Before: 1.08% content_shell content_shell [.] WTF::StringImpl::hashSlowCase() const After: 0.37% content_shell content_shell [.] WTF::StringImpl::hashSlowCase() const There are likely other savings as well, but the effect on StringImpl::hashSlowCase is the most dramatic change to the profile.
Attachments
Alexey Proskuryakov
Comment 1 2013-06-19 09:58:49 PDT
FWIW, I don't understand this change. StringBuilder only builds the string once already, and presumably does that in an optimal manner. And what does XHR response have to do with StringImpl::hashSlowCase()? Who would ever want to calculate its hash?
Geoffrey Garen
Comment 2 2013-06-19 10:08:43 PDT
I think Ben recently changed our DOM bindings to share JSStrings based on character content -- so, as the XHR is changing as new data arrives over the network, each new access from JavaScript will hash the characters in the XHR.
Geoffrey Garen
Comment 3 2013-06-19 10:09:09 PDT
Perhaps this is a reason to change back to hashing based on pointer identity.
Note You need to log in before you can comment on or make changes to this bug.