[PATCH] D41483: [clangd] Index symbols share storage within a slab.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 21 06:54:03 PST 2017


sammccall marked an inline comment as done.
sammccall added inline comments.


================
Comment at: clangd/index/Index.h:136
+  // Intern table for strings. Not StringPool as we don't refcount, just insert.
+  llvm::StringSet<llvm::BumpPtrAllocator> Strings;
   llvm::DenseMap<SymbolID, Symbol> Symbols;
----------------
ilya-biryukov wrote:
> A comment on why we use `BumpPtrAllocator` here might be useful.
> I.e., it uses more memory than malloc, but we're getting better data locality. (I hope that I got its intention right)
It's strictly better than malloc for us I think:
 - no malloc bookkeeping/padding memory overhead
 - we make lots of tiny allocations, they're much cheaper in CPU
 - the locality you mentioned
There's no extra memory usage: stringset doesn't use the allocator to allocate the hashtable, just the nodes.

Added a comment.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41483





More information about the cfe-commits mailing list