[cfe-dev] Question on clang design - Why clang doesn't use pooling of Process

Journeyer J. Joh oosaprogrammer at gmail.com
Wed Jul 25 17:53:08 PDT 2012


Hi Konstantin Tokarev, David Blaikie and Douglas Gregor

David Blaikie, please refer to Douglas Gregor's message. He pointed
exactly what I wondered.
Konstantin Tokarev, for the compatibility of many different systems as
you said it wouldn't be that difficult, because there exist many
middleware C++ library like ACE, boost, ....

And, Douglas Gregor, I understood that my worrying was worried about
by many other people before already.

Thank you very much for paying attention to my question.

Journeyer J. Joh

2012/7/26 Douglas Gregor <dgregor at apple.com>:
>
> On Jul 25, 2012, at 9:46 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Wed, Jul 25, 2012 at 4:46 AM, Journeyer J. Joh
>> <oosaprogrammer at gmail.com> wrote:
>>> Hello, list
>>>
>>> I am reading clang source code.
>>> And while my reading of it I found that clang as a driver invokes
>>> another clang as a worker process to convert a input file to the
>>> output file.
>>> This method looks weird to me because the driver clang invokes worker
>>> clang so many times. It would be the number of input source  file!
>>> This means that 1000 C source code compile would invokes clang 1000 +
>>> 1 times.
>>>
>>> For server programming this kind of work is handled by processpool or
>>> threadpool.
>>>
>>> Pooling invokes process' or threads only a certain times like 10 times
>>> and with this 10 process of threads tasks are handled with no more
>>> loading of process load or creating new thread load.
>>
>> I'm a little confused. Are you suggesting that if you run "clang a.cpp
>> b.cpp -fsyntax-only" (just to ignore linking & other issues) there are
>> a total of 3 processes created? The driver and then two separate
>> frontend actions for a.cpp and b.cpp?
>
> Yes, that is correct. There will be one -cc1 process per.
>
> The real question is whether the process startup overhead is a measurable part of compilation time for a realistic source file. IIRC, we looked at this a while ago, and the answer is "no, not measurable", so it wasn't worth changing.
>
>         - Doug
>



-- 
----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------



More information about the cfe-dev mailing list