Changeset 201520 in webkit
- Timestamp:
- May 31, 2016, 12:45:10 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
heap/HeapSnapshot.cpp (modified) (4 diffs)
-
heap/HeapSnapshot.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r201495 r201520 1 2016-05-31 Saam Barati <sbarati@apple.com> 2 3 Web Inspector: capturing with Allocations timeline causes GC to take 100x longer and cause frame drops 4 https://bugs.webkit.org/show_bug.cgi?id=158054 5 <rdar://problem/25280762> 6 7 Reviewed by Joseph Pecoraro. 8 9 HeapSnapshot::sweepCell was taking a long time on 10 http://bl.ocks.org/syntagmatic/6c149c08fc9cde682635 11 because it has to do a binary search to find if 12 an item is or is not in the list. 90% of the binary searches 13 would not find anything. This resulted in a lot of wasted time. 14 15 This patch adds a TinyBloomFilter member variable to HeapSnapshot. 16 We use this filter to try to bypass doing a binary search when the 17 filter tells us that a particular JSCell is definitely not in our 18 list. This is a 2x speedup on the steady state GC of the above 19 website. 20 21 * heap/HeapSnapshot.cpp: 22 (JSC::HeapSnapshot::appendNode): 23 (JSC::HeapSnapshot::sweepCell): 24 (JSC::HeapSnapshot::shrinkToFit): 25 (JSC::HeapSnapshot::nodeForCell): 26 * heap/HeapSnapshot.h: 27 1 28 2016-05-29 Saam barati <sbarati@apple.com> 2 29 -
trunk/Source/JavaScriptCore/heap/HeapSnapshot.cpp
r197489 r201520 46 46 47 47 m_nodes.append(node); 48 m_filter.add(bitwise_cast<uintptr_t>(node.cell)); 48 49 } 49 50 … … 52 53 ASSERT(cell); 53 54 54 if (m_finalized && !isEmpty()) { 55 if (m_finalized && !m_filter.ruleOut(bitwise_cast<uintptr_t>(cell))) { 56 ASSERT_WITH_MESSAGE(!isEmpty(), "Our filter should have ruled us out if we are empty."); 55 57 unsigned start = 0; 56 58 unsigned end = m_nodes.size(); … … 80 82 { 81 83 if (m_finalized && m_hasCellsToSweep) { 84 m_filter.reset(); 82 85 m_nodes.removeAllMatching( 83 86 [&] (const HeapSnapshotNode& node) -> bool { 84 return reinterpret_cast<intptr_t>(node.cell) & CellToSweepTag; 87 bool willRemoveCell = bitwise_cast<intptr_t>(node.cell) & CellToSweepTag; 88 if (!willRemoveCell) 89 m_filter.add(bitwise_cast<uintptr_t>(node.cell)); 90 return willRemoveCell; 85 91 }); 86 92 m_nodes.shrinkToFit(); … … 127 133 ASSERT(m_finalized); 128 134 129 if (!isEmpty()) { 135 if (!m_filter.ruleOut(bitwise_cast<uintptr_t>(cell))) { 136 ASSERT_WITH_MESSAGE(!isEmpty(), "Our filter should have ruled us out if we are empty."); 130 137 unsigned start = 0; 131 138 unsigned end = m_nodes.size(); -
trunk/Source/JavaScriptCore/heap/HeapSnapshot.h
r197489 r201520 28 28 29 29 #include "HeapSnapshotBuilder.h" 30 #include "TinyBloomFilter.h" 30 31 #include <wtf/Optional.h> 31 32 … … 54 55 55 56 Vector<HeapSnapshotNode> m_nodes; 57 TinyBloomFilter m_filter; 56 58 HeapSnapshot* m_previous { nullptr }; 57 59 unsigned m_firstObjectIdentifier { 0 };
Note:
See TracChangeset
for help on using the changeset viewer.