Web Inspector: capturing with Allocations timeline causes GC to take 100x longer...
authorsbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2016 19:45:10 +0000 (19:45 +0000)
committersbarati@apple.com <sbarati@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 31 May 2016 19:45:10 +0000 (19:45 +0000)
commitab20a41fb193bba8d10d158a5f98f10bc5b0929c
tree771a54796bd313d40a04359054da358aaf1f2784
parent2e1dab4c8a130a93b38f453a41d39bcce96db626
Web Inspector: capturing with Allocations timeline causes GC to take 100x longer and cause frame drops
https://bugs.webkit.org/show_bug.cgi?id=158054
<rdar://problem/25280762>

Reviewed by Joseph Pecoraro.

HeapSnapshot::sweepCell was taking a long time on
http://bl.ocks.org/syntagmatic/6c149c08fc9cde682635
because it has to do a binary search to find if
an item is or is not in the list. 90% of the binary searches
would not find anything. This resulted in a lot of wasted time.

This patch adds a TinyBloomFilter member variable to HeapSnapshot.
We use this filter to try to bypass doing a binary search when the
filter tells us that a particular JSCell is definitely not in our
list. This is a 2x speedup on the steady state GC of the above
website.

* heap/HeapSnapshot.cpp:
(JSC::HeapSnapshot::appendNode):
(JSC::HeapSnapshot::sweepCell):
(JSC::HeapSnapshot::shrinkToFit):
(JSC::HeapSnapshot::nodeForCell):
* heap/HeapSnapshot.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@201520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/HeapSnapshot.cpp
Source/JavaScriptCore/heap/HeapSnapshot.h