[Scons-dev] Excessive exec calls at startup

Johan Holmberg johan556 at gmail.com
Mon Nov 23 16:50:30 EST 2015


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.

/Johan Holmberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/scons-dev/attachments/20151123/b9c2a359/attachment-0001.html>


More information about the Scons-dev mailing list