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);


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);
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to