mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
Special case Recycler::clear(BumpPtrAllocator).
A BumpPtrAllocator has an empty Deallocate() method, but Recycler::clear() would still call it for every single object ever allocated, bringing all those objects into cache. As a bonus, iplist::remove() will also write to the Prev/Next pointers on all the objects, so all those cache lines have to be written back to RAM before the pages are given back to the OS. Stop wasting time and memory bandwith by using the new clearAndLeakUnsafely() function to jettison all the recycled objects. llvm-svn: 171541
This commit is contained in:
parent
499d789d2b
commit
4c9d7d3d77
@ -22,6 +22,8 @@
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class BumpPtrAllocator;
|
||||
|
||||
/// PrintRecyclingAllocatorStats - Helper for RecyclingAllocator for
|
||||
/// printing statistics.
|
||||
///
|
||||
@ -87,6 +89,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
/// Special case for BumpPtrAllocator which has an empty Deallocate()
|
||||
/// function.
|
||||
///
|
||||
/// There is no need to traverse the free list, pulling all the objects into
|
||||
/// cache.
|
||||
void clear(BumpPtrAllocator&) {
|
||||
FreeList.clearAndLeakNodesUnsafely();
|
||||
}
|
||||
|
||||
template<class SubClass, class AllocatorType>
|
||||
SubClass *Allocate(AllocatorType &Allocator) {
|
||||
assert(sizeof(SubClass) <= Size &&
|
||||
|
Loading…
Reference in New Issue
Block a user