[PATCH] D52300: [clangd] Implement VByte PostingList compression

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 25 04:35:15 PDT 2018


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

LG, don't forget about the fuzzer!



================
Comment at: clang-tools-extra/clangd/index/dex/PostingList.cpp:41
            "Posting List iterator can't advance() at the end.");
-    ++Index;
+    if (++CurrentID == DecompressedChunk.end()) { // reached end of chunk
+      if (++CurrentChunk == Chunks.end())         // reached the end
----------------
just `++CurrentID; normalizeCursor();`


================
Comment at: clang-tools-extra/clangd/index/dex/PostingList.cpp:131
 
+static constexpr size_t BitsPerEncodingByte = 7;
+
----------------
this is used only in one place now, inline or use elsewhere


================
Comment at: clang-tools-extra/clangd/index/dex/PostingList.cpp:138
+  // Calculate number of bytes Delta encoding would take by rounding up number
+  // of meaningful bytes divided by Chunk::BitsPerEncodingByte.
+  unsigned Width = 1 + llvm::findLastSet(Delta) / 7;
----------------
meaningful *bits*

no need to say "dividing..." as it just echoes the code. "examining the meaningful bits"?


================
Comment at: clang-tools-extra/clangd/index/dex/PostingList.cpp:174
+  std::vector<Chunk> Result;
+  std::array<uint8_t, Chunk::PayloadSize> Payload;
+  Payload.fill(0);
----------------
unused


https://reviews.llvm.org/D52300





More information about the cfe-commits mailing list