[PATCH] D135314: [clangd] Avoid scanning up to end of file on each comment!

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 5 13:27:27 PDT 2022


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

Assigning char* (pointing at comment start) to StringRef was causing us
to scan the rest of the source file looking for the null terminator.

This seems to be eating about 8% of our *total* CPU!

While fixing this, factor out the common bits from the two places we're
parsing IWYU pragmas.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D135314

Files:
  clang-tools-extra/clangd/Headers.cpp
  clang-tools-extra/clangd/Headers.h
  clang-tools-extra/clangd/index/CanonicalIncludes.cpp
  clang-tools-extra/clangd/unittests/HeadersTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135314.465531.patch
Type: text/x-patch
Size: 5959 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221005/94c46d3f/attachment.bin>


More information about the cfe-commits mailing list