[clang-tools-extra] r340729 - [clangd] Use TRUE iterator instead of complete posting list

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 27 02:47:51 PDT 2018


Author: omtcyfz
Date: Mon Aug 27 02:47:50 2018
New Revision: 340729

URL: http://llvm.org/viewvc/llvm-project?rev=340729&view=rev
Log:
[clangd] Use TRUE iterator instead of complete posting list

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
```

Reviewed by: ilya-biryukov

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

Modified:
    clang-tools-extra/trunk/clangd/index/dex/Trigram.cpp

Modified: clang-tools-extra/trunk/clangd/index/dex/Trigram.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/Trigram.cpp?rev=340729&r1=340728&r2=340729&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/dex/Trigram.cpp (original)
+++ clang-tools-extra/trunk/clangd/index/dex/Trigram.cpp Mon Aug 27 02:47:50 2018
@@ -67,10 +67,6 @@ std::vector<Token> generateIdentifierTri
     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}});
 




More information about the cfe-commits mailing list