[all-commits] [llvm/llvm-project] 6ea83f: [clangd] Don't clone SymbolSlab::Builder arenas wh...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Oct 5 11:59:12 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ea83fc98fd120066c3c42d88c5517ab811152bc
      https://github.com/llvm/llvm-project/commit/6ea83fc98fd120066c3c42d88c5517ab811152bc
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-10-05 (Wed, 05 Oct 2022)

  Changed paths:
    M clang-tools-extra/clangd/index/Symbol.cpp

  Log Message:
  -----------
  [clangd] Don't clone SymbolSlab::Builder arenas when finalizing.

SymbolSlab::Builder has an arena to store strings of owned symbols, and
deduplicates them. build() copies all the strings and deduplicates them again!
This is potentially useful: we may have overwritten a symbol and
rendered some strings unreachable.

However in practice this is not the case. When testing on a variety of
files in LLVM (e.g. SemaExpr.cpp), the strings for the full preamble
index are 3MB and shrink by 0.4% (12KB). For comparison the serializde
preamble is >50MB.
There are also hundreds of smaller slabs (file sharding) that do not shrink at
all.

CPU time spent on this is significant (something like 3-5% of buildPreamble).
We're better off not bothering.

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




More information about the All-commits mailing list