This is an archive of the discontinued LLVM Phabricator instance.

[llvm] Add a way to speed up the speed in which BumpPtrAllocator increases slab sizes
ClosedPublic

Authored by teemperor on Dec 18 2019, 4:10 AM.

Details

Summary

In D68549 we noticed that our BumpPtrAllocator we use for LLDB's ConstString implementation is growing its slabs at
a rate that is too slow for our use case. It causes that we spend a lot of time calling malloc for all the tiny slabs that our
ConstString BumpPtrAllocators create. We also can't just increase the slab size in the ConstString implementation
(which is what D68549 originally did) as this really increased the amount of (mostly unused) allocated memory
in any process using ConstString.

This patch adds a template argument for the BumpPtrAllocatorImpl that allows specifying a faster rate at which the
BumpPtrAllocator increases the slab size. This allows LLDB to specify a faster rate at which the slabs grow which
should keep both memory consumption and time spent calling malloc low.

Diff Detail

Event Timeline

teemperor created this revision.Dec 18 2019, 4:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 18 2019, 4:10 AM
NoQ accepted this revision.Dec 19 2019, 12:32 PM
NoQ edited reviewers, added: NoQ; removed: dergachev.a.
NoQ added a subscriber: NoQ.

Looks straightforward and useful, i don't see any problems, LGTM!

llvm/include/llvm/Support/Allocator.h
140

I think it should be "specifies".

This revision was not accepted when it landed; it landed in state Needs Review.Feb 3 2020, 12:17 AM
This revision was automatically updated to reflect the committed changes.