[cfe-dev] [clangd] ClangdScheduler & LLVM ThreadPool

Ilya Biryukov via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 29 03:27:24 PST 2017


Hi Jan,

Implementation used in clangd is a little specific to clangd, e.g. it
allows to add requests to both ends of the queue (to allow high-priority
ops like completion to be run before everything else).
We'll also be moving away from ThreadPool-like interface for
ClangdScheduler to better handle the resources we use and minimize unneeded
pauses (e.g., we wait() for ASTs to parse on the worker threads, keeping
workers from doing useful work).

I'm currently working on revamped threading implementation in clangd, so I
suggest waiting before it lands. (I'll make sure to update this thread when
it does).
I'll also keep an eye on whether we would be able to reuse the ThreadPool
in the new implementation.

On Wed, Nov 29, 2017 at 11:33 AM, Jan Korous via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi all,
>
> I am wondering about the fact that there is an implementation of
> asynchronous message queue (ClangdScheduler) in clangd which in principle
> is similar to what ThreadPool in LLVM Support does. I just wanted to ask
> what other people think about possibility of using ThreadPool in clangd as
> we could potentially spare some resources on maintaining only one version.
> It’s not a lot of code and those two implementations are not exactly the
> same so some one-time effort would be needed but it still might be
> worthwhile.
>
> https://github.com/llvm-mirror/clang-tools-extra/blob/
> master/clangd/ClangdServer.h
> https://github.com/llvm-mirror/clang-tools-extra/blob/
> master/clangd/ClangdServer.cpp
> <https://github.com/llvm-mirror/clang-tools-extra/blob/master/clangd/ClangdServer.h>
>
> https://github.com/llvm-mirror/llvm/blob/master/include/llvm/Support/
> ThreadPool.h
> https://github.com/llvm-mirror/llvm/blob/master/lib/Support/ThreadPool.cpp
>
>
> Regards,
> Jan
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>


-- 
Regards,
Ilya Biryukov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171129/a77930f4/attachment-0001.html>


More information about the cfe-dev mailing list