[PATCH] D52083: [clangd] Store OR iterator children in heap

Kirill Bobyrev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 03:25:34 PDT 2018


kbobyrev created this revision.
kbobyrev added reviewers: ioeric, sammccall, ilya-biryukov.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.

Use min-heap invariant for OR iterator's children. This helps to avoid iterating through all children in `reachedEnd()`, `peek()` and allows early-stopping in `consume()` and `advance()`.

This optimization results in ~8-9% of performance boost on benchmark with ~4300 real queries to LLVM static index.

benchmark's `compare.py` output:

  benchmark                    Time             CPU      Time Old      Time New       CPU Old       CPU New
  ---------------------------------------------------------------------------------------------------------
  DexQueries                -0.0706         -0.0706    4719149241    4385985920    4719100956    4385946455


https://reviews.llvm.org/D52083

Files:
  clang-tools-extra/clangd/index/dex/Iterator.cpp
  clang-tools-extra/unittests/clangd/DexTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52083.165460.patch
Type: text/x-patch
Size: 5761 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180914/a685e0e6/attachment.bin>


More information about the cfe-commits mailing list