>> As mentioned above, when `call-process' is used, it takes 2 seconds
>> for Clang to generate 15,000 lines of completion results and then the
>> results gets received by Emacs in a temporary buffer. 2 seconds is
>> painful but still OK.
>
> Which part of those 2 seconds is due to clang, and which part to Emacs?
I don't know exactly the proportion of time being consumed, but I think most of
the 2 seconds are consumed by the clang program. Is there an easy way to know
exactly how long haven been consumed by Emacs to receive the output from clang?
>> Because of the slowness, I tried to add the functionality to be able
>> to call Clang asynchronously so that the keyboard input will not be
>> blocked while awaiting the completion results. What had driven me
>> crazy is that it takes more than 15 seconds for Emacs to receive the
>> 15,000 lines of completion results if `start-process' is is being used
>> to call the Clang executable. During this 15 seconds I was not typing
>> anything so Emacs is "idling". The question is why `start-process'
>> takes 15 seconds while `call-process' takes only 2 seconds, and what
>> can I do about it?
> I assume those lines aren't terribly long.
The longest line had exceeded 200, I noticed this because there had been a time
I had to set `line-number-display-limit-width' to over 200 (default being 200)
in order for `column-number-mode' to be able to display the column number if the
maximum length of lines in a buffer exceeds 200.
> so we might be talking about less than 1MB of data
The size is actually 1.4MB.
> I suggest you report it as a bug (via M-x report-emacs-bug), trying to provide
> as much info as possible to make it reproducible (e.g. replacing clang with a
> "cat" that simply outputs those 15K lines).
Replacing "clang" with "cat" is a good idea to reproduce the problem. I might
have to report the bug, thanks for your suggestion.
Thanks,
York