[Lldb-commits] [PATCH] D13727: Add task pool to LLDB

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 14 10:28:34 PDT 2015

tberghammer added a comment.

We can change this class to use std::async on Windows and an std::thread based implementation on Linux with the same interface (other OS-es should be decided) but I would prefer to use just 1 logic as it is easier to maintain.

Limiting the number of threads with adding a semaphore to the beginning of the lambda given to std::async wouldn't work because if the number of threads aren't limited inside the implementation of std::async then we still create a huge number of threads what will be blocked on the semaphore call but they still consume the resources. Guarding the std::async calls with a semaphore can limit the number of thread but it will make them a blocking call what isn't really something I want to see.

On Linux using this thread pooling code instead of std::async achieved a ~25% speedup on the dwarf parsing code. I haven't investigated the exact reasons but I think the difference is that we don't create a lot of thread (thread creation isn't too cheap) and the lower number of threads decrease the number of congestion.


More information about the lldb-commits mailing list