[clang-tools-extra] r353422 - [clangd] Reduce number of threads used by BackgroundIndex to number of physical cores.

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 27 06:51:56 PST 2019


Merged to release_80 in r354980.

On Thu, Feb 7, 2019 at 5:04 PM Kadir Cetinkaya via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: kadircet
> Date: Thu Feb  7 08:04:30 2019
> New Revision: 353422
>
> URL: http://llvm.org/viewvc/llvm-project?rev=353422&view=rev
> Log:
> [clangd] Reduce number of threads used by BackgroundIndex to number of physical cores.
>
> Summary:
> clangd is using as many threads as logical cores for BackgroundIndex
> by default. We observed that it increases latency of foreground tasks.
>
> This patch aims to change that default to number of physical cores to get rid of
> that extra latency.
>
> Reviewers: ilya-biryukov
>
> Reviewed By: ilya-biryukov
>
> Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits
>
> Tags: #clang
>
> Differential Revision: https://reviews.llvm.org/D57819
>
> Modified:
>     clang-tools-extra/trunk/clangd/index/Background.h
>
> Modified: clang-tools-extra/trunk/clangd/index/Background.h
> URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/Background.h?rev=353422&r1=353421&r2=353422&view=diff
> ==============================================================================
> --- clang-tools-extra/trunk/clangd/index/Background.h (original)
> +++ clang-tools-extra/trunk/clangd/index/Background.h Thu Feb  7 08:04:30 2019
> @@ -67,11 +67,12 @@ public:
>    /// If BuildIndexPeriodMs is greater than 0, the symbol index will only be
>    /// rebuilt periodically (one per \p BuildIndexPeriodMs); otherwise, index is
>    /// rebuilt for each indexed file.
> -  BackgroundIndex(Context BackgroundContext, const FileSystemProvider &,
> -                  const GlobalCompilationDatabase &CDB,
> -                  BackgroundIndexStorage::Factory IndexStorageFactory,
> -                  size_t BuildIndexPeriodMs = 0,
> -                  size_t ThreadPoolSize = llvm::hardware_concurrency());
> +  BackgroundIndex(
> +      Context BackgroundContext, const FileSystemProvider &,
> +      const GlobalCompilationDatabase &CDB,
> +      BackgroundIndexStorage::Factory IndexStorageFactory,
> +      size_t BuildIndexPeriodMs = 0,
> +      size_t ThreadPoolSize = llvm::heavyweight_hardware_concurrency());
>    ~BackgroundIndex(); // Blocks while the current task finishes.
>
>    // Enqueue translation units for indexing.
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list