[PATCH] D106528: [clangd] Improve performance of dex by 45-60%

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 22 01:24:23 PDT 2021


kbobyrev created this revision.
kbobyrev added a reviewer: sammccall.
Herald added subscribers: usaxena95, arphaman.
kbobyrev requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

Take full advantage of AND's iterator children size estimation: use early reset
in sync() and prevent large overhead. This change was tested on a comprehensive
query dataset. The performance boost increases with the average length of the
query, on small queries it is close to 45% but the longer they go the closer it
gets to 60% and beyond.


Repository:
  rG LLVM Github Monorepo

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
@@ -109,6 +109,9 @@
         if (Child->peek() > SyncID) {
           SyncID = Child->peek();
           NeedsAdvance = true;
+          // Reset and make sure advanceTo happens much less frequently on
+          // large posting lists. This accounts for 45-60% performance boost.
+          break;
         }
       }
     } while (NeedsAdvance);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106528.360726.patch
Type: text/x-patch
Size: 575 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210722/d150c461/attachment.bin>


More information about the cfe-commits mailing list