[Scons-dev] Excessive exec calls at startup

William Blevins wblevins001 at gmail.com
Mon Nov 23 19:54:31 EST 2015


On Mon, Nov 23, 2015 at 9:50 PM, Johan Holmberg <johan556 at gmail.com> wrote:

> On Mon, Nov 23, 2015 at 11:18 AM, Ivan Nedrehagen <ivan at nedrehagen.com>
> wrote:
>
>> Just an idea, as creating loads of new environments aren't unusual.
>> Perhaps caching the version like this would be impossible, but how about
>> caching results based on executable paths and arguments?
>> Regards,
>> Ivan Nedrehagen
>>
>>
>
> I think that was what my patch tried to do. If the parameter named "cc"
> had the value "gcc", the call to env.WhereIs(cc) returned "/usr/bin/gcc",
> and I used that full path as key in the dict caching the results. I just
> assumed that "/usr/bin/gcc --version" would return the same thing each time
> it was called. (perhaps WhereIs() is not the right way to find the absolute
> path of a program, but it seemed to work).
>
>
> On Mon, Nov 23, 2015 at 5:04 AM, Jason Kenny <dragon512 at live.com> wrote:
>
>> I make a new environments myself all the time. The trick is to Clone() a
>> new environment, not create a new one from scratch each time you need a new
>> one.
>> Jason
>>
>
>
> I hadn't realised that Clone() was much cheaper. I tried just now with
> Clone() and it works well for me, and is even slightly faster than my patch.
>

Clone creates a substitute environment from the original rather than
creating a branch new environment, so if you are only overriding a few
variables, then Clone is much cheaper memory and performance wise.


>
> /Johan Holmberg
>
>
> _______________________________________________
> Scons-dev mailing list
> Scons-dev at scons.org
> https://pairlist2.pair.net/mailman/listinfo/scons-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20151124/c68cb48e/attachment.html>


More information about the Scons-dev mailing list