[all-commits] [llvm/llvm-project] b848b5: [llvm] Add a way to speed up the speed in which Bu...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Mon Feb 3 00:12:05 PST 2020

  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: b848b510a8d52dbf50ee53a9a1ce844abb60d9bd
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2020-02-03 (Mon, 03 Feb 2020)

  Changed paths:
    M llvm/include/llvm/Support/Allocator.h
    M llvm/unittests/Support/AllocatorTest.cpp

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

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.

Reviewers: george.karpenkov, chandlerc, NoQ

Subscribers: NoQ, llvm-commits, llunak

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71654

More information about the All-commits mailing list