[PATCH] D51287: [clangd] Use TRUE iterator instead of complete posting list
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 27 01:52:55 PDT 2018
kbobyrev created this revision.
kbobyrev added a reviewer: ilya-biryukov.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.
kbobyrev edited the summary of this revision.
Stop using `$$$` (empty) trigram and generating a posting list with all items. Since TRUE iterator is already implemented and correctly inserted when there are no real trigram posting lists, this is a valid transformation.
Benchmarks show that this simple change allows ~30% speedup on dataset of real completion queries.
Before
-------------------------------------------------------
Benchmark Time CPU Iterations
-------------------------------------------------------
DexAdHocQueries 5640321 ns 5640265 ns 120
DexRealQ 939835603 ns 939830296 ns 1
After
-------------------------------------------------------
Benchmark Time CPU Iterations
-------------------------------------------------------
DexAdHocQueries 3452014 ns 3451987 ns 203
DexRealQ 667455912 ns 667455750 ns 1
https://reviews.llvm.org/D51287
Files:
clang-tools-extra/clangd/index/dex/Trigram.cpp
Index: clang-tools-extra/clangd/index/dex/Trigram.cpp
===================================================================
--- clang-tools-extra/clangd/index/dex/Trigram.cpp
+++ clang-tools-extra/clangd/index/dex/Trigram.cpp
@@ -67,10 +67,6 @@
UniqueTrigrams.insert(Token(Token::Kind::Trigram, Chars));
};
- // FIXME(kbobyrev): Instead of producing empty trigram for each identifier,
- // just use True Iterator on the query side when the query string is empty.
- add({{END_MARKER, END_MARKER, END_MARKER}});
-
if (TwoHeads.size() == 2)
add({{TwoHeads.front(), TwoHeads.back(), END_MARKER}});
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51287.162633.patch
Type: text/x-patch
Size: 615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180827/de3ac096/attachment-0001.bin>
More information about the cfe-commits
mailing list