[all-commits] [llvm/llvm-project] 735ab4: [clangd] Don't create as much garbage while buildi...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu May 14 04:51:48 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 735ab46cb4148c92d636c912832a32509252b579
      https://github.com/llvm/llvm-project/commit/735ab46cb4148c92d636c912832a32509252b579
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2020-05-14 (Thu, 14 May 2020)

  Changed paths:
    M clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp
    M clang-tools-extra/clangd/index/dex/Dex.cpp
    M clang-tools-extra/clangd/index/dex/Trigram.cpp
    M clang-tools-extra/clangd/index/dex/Trigram.h
    M clang-tools-extra/clangd/test/Inputs/requests.json
    M clang-tools-extra/clangd/unittests/DexTests.cpp

  Log Message:
  -----------
  [clangd] Don't create as much garbage while building Dex index.

Summary:
The Token objects are relatively expensive and we were spending a lot of
CPU creating them for each trigram emitted. Instead, use a tiny trigram
structure until we're ready to finalize the index.

This improves the new BuildDex benchmark by 20%. This code is hot and on
the critical path in clangd: it runs after a new preamble is built.

Reviewers: kbobyrev

Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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




More information about the All-commits mailing list