[PATCH] D79918: [clangd] Don't create as much garbage while building Dex index.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 18:02:23 PDT 2020


sammccall created this revision.
sammccall added a reviewer: kbobyrev.
Herald added subscribers: cfe-commits, usaxena95, kadircet, arphaman, mgrang, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79918

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79918.263900.patch
Type: text/x-patch
Size: 15988 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200514/dad46247/attachment-0001.bin>


More information about the cfe-commits mailing list