[all-commits] [llvm/llvm-project] 5d2d52: [clangd] Avoid scanning up to end of file on each ...

Sam McCall via All-commits all-commits at lists.llvm.org
Thu Oct 6 02:39:15 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5d2d527c32da2081b814ef8b446bc3e037f74b0a
      https://github.com/llvm/llvm-project/commit/5d2d527c32da2081b814ef8b446bc3e037f74b0a
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-10-06 (Thu, 06 Oct 2022)

  Changed paths:
    M clang-tools-extra/clangd/Headers.cpp
    M clang-tools-extra/clangd/Headers.h
    M clang-tools-extra/clangd/index/CanonicalIncludes.cpp
    M clang-tools-extra/clangd/unittests/HeadersTests.cpp

  Log Message:
  -----------
  [clangd] Avoid scanning up to end of file on each comment!

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.

Differential Revision: https://reviews.llvm.org/D135314




More information about the All-commits mailing list