RESOLVED FIXED 158506
CachedScript should avoid recomputing its hash multiple times.
https://bugs.webkit.org/show_bug.cgi?id=158506
Summary CachedScript should avoid recomputing its hash multiple times.
Andreas Kling
Reported 2016-06-07 17:58:00 PDT
CachedScript::script() can skip string hashing if we've already decoded the script before and saved the hash (in m_scriptHash.) This should help JSBench quite a bit.
Attachments
Patch (1.63 KB, patch)
2016-06-07 18:00 PDT, Andreas Kling
saam: review+
Patch for landing (1.61 KB, patch)
2016-06-07 18:21 PDT, Andreas Kling
no flags
Andreas Kling
Comment 1 2016-06-07 18:00:15 PDT
Saam Barati
Comment 2 2016-06-07 18:12:57 PDT
Comment on attachment 280753 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=280753&action=review R=me > Source/WebCore/loader/cache/CachedScript.cpp:96 > + // If we've decoded this once before, we already have the hash in m_scriptHash. We could also just assert this Like: ASSERT(!m_scriptHash || m_scriptHash == m_script.impl()->hash())
Saam Barati
Comment 3 2016-06-07 18:14:29 PDT
Comment on attachment 280753 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=280753&action=review >> Source/WebCore/loader/cache/CachedScript.cpp:96 >> + // If we've decoded this once before, we already have the hash in m_scriptHash. > > We could also just assert this > Like: > ASSERT(!m_scriptHash || m_scriptHash == m_script.impl()->hash()) (If we start with m_scriptHash at zero)
Andreas Kling
Comment 4 2016-06-07 18:21:37 PDT
Created attachment 280757 [details] Patch for landing
WebKit Commit Bot
Comment 5 2016-06-07 18:52:17 PDT
Comment on attachment 280757 [details] Patch for landing Clearing flags on attachment: 280757 Committed r201784: <http://trac.webkit.org/changeset/201784>
WebKit Commit Bot
Comment 6 2016-06-07 18:52:21 PDT
All reviewed patches have been landed. Closing bug.
Geoffrey Garen
Comment 7 2016-06-08 10:29:01 PDT
Comment on attachment 280757 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=280757&action=review > Source/WebCore/ChangeLog:12 > + This takes total time spent in StringImpl::hashSlowCase() from 1600ms to 77ms on my MBP. huehuehue
Andreas Kling
Comment 8 2016-06-08 18:41:17 PDT
(In reply to comment #7) > Comment on attachment 280757 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=280757&action=review > > > Source/WebCore/ChangeLog:12 > > + This takes total time spent in StringImpl::hashSlowCase() from 1600ms to 77ms on my MBP. > > huehuehue Unfortunately it looks like this silliness was taking place outside of JSBench measurement signposts :|
Note You need to log in before you can comment on or make changes to this bug.