[cfe-dev] Thread pool for llvm::CrashRecoveryContext::RunSafelyOnThread?

Milian Wolff mail at milianw.de
Tue Apr 29 03:38:00 PDT 2014


On Monday 28 April 2014 20:43:35 Dmitri Gribenko wrote:
> On Mon, Apr 28, 2014 at 7:04 PM, Milian Wolff <mail at milianw.de> wrote:
> > Would it not be better, performance-wise, to recycle the threads in a
> > thread pool?
> 
> This certainly could give us some speedup.  How much does
> pthread_create() cost on your system?

Based on the simple attached example, the benefit is pretty small. I.e., on my 
machine the reusable thread runs the test in ~1.9s, while the iterative 
approach takes ~5.2s.

That is a cost saving of only ~3s over a run of 100000 iterations. Considering 
that the workload in clang is much higher, I doubt the time savings will be 
noticeable. The only thing that will be noticeable, is one from the tooling 
perspective: You don't see threads being created and deleted all the time 
(esp. in GDB).

But I could understand if this is not worth the extra code required to reuse a 
thread.

Bye
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.cpp
Type: text/x-c++src
Size: 2902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140429/109c8a34/attachment.cpp>


More information about the cfe-dev mailing list