Slow build times with SCons?

I’m a big fan of SCons… mainly because it’s based on Python, and that allows me to handle a number of weird cases that I must deal with (everything from building drivers to embedded code). However, it’s not without it’s warts. Recently I discovered that you really need to be judicious with your use of Environment(). I didn’t feel I was creating all that many of them, and to be honest, I really wasn’t. The symptom I was seeing was that builds of only a few files would take 41 seconds to complete. After firing up the profiler, I discovered that the problem was the roughly 3600 calls to WhereIs, most of which used my default path. Unfortunately, that also has a network drive in it (so that I always have access to my tools, no matter which computer I use). The end results was that the bulk of the time was spent searching on the network drive for a gamut of tools (several hundred of them!).

I went back and fixed up all of the Environment calls to pull only the tools that I needed, and the build time dropped from 41 seconds to 5.8 seconds. So, when creating your construction environments in SCons, beware of what you’re asking for.