[PATCH] D106528: [clangd] Improve performance of dex by 45-60%
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 23 06:29:07 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa0987e350ccc: [clangd] Improve performance of dex by 45-60% (authored by kbobyrev).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106528/new/
https://reviews.llvm.org/D106528
Files:
clang-tools-extra/clangd/index/dex/Iterator.cpp
Index: clang-tools-extra/clangd/index/dex/Iterator.cpp
===================================================================
--- clang-tools-extra/clangd/index/dex/Iterator.cpp
+++ clang-tools-extra/clangd/index/dex/Iterator.cpp
@@ -104,11 +104,19 @@
// In this case, just terminate the process.
if (ReachedEnd)
return;
+ // Cache the result so that peek() is not called again as it may be
+ // quite expensive in AND with large subtrees.
+ auto Candidate = Child->peek();
// If any child goes beyond given ID (i.e. ID is not the common item),
// all children should be advanced to the next common item.
- if (Child->peek() > SyncID) {
- SyncID = Child->peek();
+ if (Candidate > SyncID) {
+ SyncID = Candidate;
NeedsAdvance = true;
+ // Reset and try to sync again. Sync starts with the first child as
+ // this is the cheapest (smallest size estimate). This way advanceTo
+ // is called on the large posting lists once the sync point is very
+ // likely.
+ break;
}
}
} while (NeedsAdvance);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106528.361176.patch
Type: text/x-patch
Size: 1169 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210723/3000fd9f/attachment-0001.bin>
More information about the cfe-commits
mailing list