llvm-project/clang-tools-extra/clangd/index
Ilya Biryukov 30c86b64da [clangd] Skip function bodies inside processed files while indexing
Summary:
This significantly improves performance of background indexing.

We do not collect references and declarations inside the processed
files, so this does not affect the final indexing results.

The idea is borrowed from libclang, which has a similar optimization in
its indexing functionality.

Measurements show a nice decrease in indexing time, up to ~40% for
building the whole index. These are not proper benchmarks, so one should
not rely on these results too much.

1. Rebuilding the whole index for LLVM:
  - Before. Total time: 14m58s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  23917.67s user 515.86s system 2718% cpu 14:58.68 total
  - After. Total time: 8m41s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  13627.29s user 288.10s system 2672% cpu 8:40.67 total

2. Rebuilding index after removing shards matching '*clangd*' (case-insensitively):
  - Before. Total time: 30s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  130.94s user 6.82s system 452% cpu 30.423 total
  - After. Total time: 26s.
    ./bin/clangd -pch-storage=memory < ./clangd.input  80.51s user 5.40s system 333% cpu 25.777 total

Reviewers: kadircet, sammccall

Reviewed By: kadircet

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 369349
2019-08-20 08:54:30 +00:00
..
dex [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Background.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
Background.h Revert "Revert r366458, r366467 and r366468" 2019-07-19 10:18:52 +00:00
BackgroundIndexLoader.cpp Revert "Revert r366458, r366467 and r366468" 2019-07-19 10:18:52 +00:00
BackgroundIndexLoader.h Revert "Revert r366458, r366467 and r366468" 2019-07-19 10:18:52 +00:00
BackgroundIndexStorage.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
BackgroundQueue.cpp [clangd] Prioritize indexing of files that share a basename with the open file. 2019-07-12 10:18:42 +00:00
BackgroundRebuild.cpp Revert "Revert r366458, r366467 and r366468" 2019-07-19 10:18:52 +00:00
BackgroundRebuild.h Revert "Revert r366458, r366467 and r366468" 2019-07-19 10:18:52 +00:00
CanonicalIncludes.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
CanonicalIncludes.h [clangd] Add include-mapping for C symbols. 2019-06-21 13:32:18 +00:00
FileIndex.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
FileIndex.h [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
Index.cpp [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
Index.h [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
IndexAction.cpp [clangd] Skip function bodies inside processed files while indexing 2019-08-20 08:54:30 +00:00
IndexAction.h [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
MemIndex.cpp [clang-tools-extra] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:52:23 +00:00
MemIndex.h [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
Merge.cpp [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
Merge.h [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
Ref.cpp [clangd] Deduplicate Refs on the fly. 2019-03-08 09:26:30 +00:00
Ref.h [clangd] Use capacity() instead of size() in RefSlab::bytes() 2019-04-02 08:24:37 +00:00
Relation.cpp [clangd] Add RelationSlab 2019-06-03 04:55:46 +00:00
Relation.h [clangd] Index API and implementations for relations 2019-06-15 02:26:47 +00:00
Serialization.cpp [clangd] Also accept flags from CLANGD_FLAGS variable. 2019-07-25 07:54:48 +00:00
Serialization.h [clangd] Store hash of command line in index shards. 2019-07-04 09:51:53 +00:00
Symbol.cpp Cleanup: llvm::bsearch -> llvm::partition_point after r364719 2019-06-30 11:19:56 +00:00
Symbol.h [clangd] Fix header-guard check for include insertion, and don't index header guards. 2019-05-03 13:17:29 +00:00
SymbolCollector.cpp [clangd] Skip function bodies inside processed files while indexing 2019-08-20 08:54:30 +00:00
SymbolCollector.h [clangd] Skip function bodies inside processed files while indexing 2019-08-20 08:54:30 +00:00
SymbolID.cpp [clangd] NFC: fix clang-tidy warnings. 2019-01-25 15:14:03 +00:00
SymbolID.h Moved DenseMap support for SymbolID into SymbolID.h 2019-02-28 11:00:44 +00:00
SymbolLocation.cpp Moved SymbolLocation into its own header and implementation file 2019-02-28 11:02:01 +00:00
SymbolLocation.h [clangd] Support utf-8 offsets (rather than utf-16) as a protocol extension 2019-03-27 17:47:49 +00:00
SymbolOrigin.cpp [clangd] Use identifiers in file as completion candidates when build is not ready. 2019-04-11 09:36:36 +00:00
SymbolOrigin.h [clangd] Use identifiers in file as completion candidates when build is not ready. 2019-04-11 09:36:36 +00:00
YAMLSerialization.cpp [clangd] Serialization support for RelationSlab 2019-06-03 05:07:52 +00:00