autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFT] Remove three forks per _AC_RUN_LOG_STDERR


From: Paolo Bonzini
Subject: Re: [RFT] Remove three forks per _AC_RUN_LOG_STDERR
Date: Thu, 06 Nov 2008 15:29:20 +0100
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

Eric Blake wrote:
> According to Ralf Wildenhues on 11/6/2008 6:03 AM:
>>> -  ($1) 2>conftest.er1
>>> +  ($1) 2>conftest.err
>> Why not 2>conftest.er1 and putting an
>>   else
>>     : >conftest.err

While it is true that...

> We could find everywhere that does 'rm
> conftest.err' and instead make it 'rm conftest.er[1r]'.

... OTOH even a ":>foo" is not really really free (though not as
expensive as a fork, which costs 1-5ms system time -- they quickly add
up).  I think the empty-stderr case is way more common, so I am using my
original patch, but I admit benchmarking would be the only way to find
the truth.

Also, note that leaving it to the caller to remove conftest.er1 could be
done as an optimization even with the pre-patch code; I assumed it was
cleaned up in _AC_RUN_LOG_STDERR for cleanliness, and using "mv" kept
the cleanliness.

>>> +    mv conftest.er1 conftest.err
>> ... this needs to be 'mv -f'.

Done and pushed.  Here is the changelog:

    Remove three forks per _AC_RUN_LOG_STDERR in the common case.
    * lib/autoconf/general.m4 (_AC_RUN_LOG_STDERR): Avoid grep/rm/cat
    sequence when the program's stderr was empty, while providing a
    conftest.err file even in that case.

Thanks for the review and test!

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]