I have an SConscript that constructs targets using the m4 and sed utilities included with Cygwin.
Overall, the build takes about 42 seconds to construct 16 targets from 8 sources, but the same build only takes Make about 4 seconds! That's a tenfold time difference for what is a fairly trivial build! I know SCons has to run through the Python interpreter, so of course it won't be as fast as a native executable like Make, but still, I have to assume that with such a basic build as mine, I must be doing something really silly to be seeing such a massive time difference. Any ideas or suggestions?
Based on some suggestions in the comments, I have replaced my custom m4 builder with SCons in-built one, and I have gotten rid of the sed one altogether just to reduce the number of potential causes, and the total build time is now down to 22 seconds. You can now see the entirety of my code below:
SConstruct:
env = DefaultEnvironment(tools=['m4'])
env['ENV']['PATH'] = ['C:/cygwin/bin']
SConscript('sources/SConscript', exports = 'env', variant_dir='build', duplicate = 0,)
sources\SConscript:
from ntpath import basename # Gets a file's basename from it's pathname.
Import('env')
M4FLAGS = '-DVV_SUBDERIVATIVE_NAME=5777C -DM4_USER_MODE_CONFIGURATION=true'
for file in Glob("*.xdm"):
env.M4(target=basename(str(file))+'.orig', source=file, M4FLAGS=M4FLAGS)
m4
andsed
builders come from? The default M4 builder as provided out-of-the-box should be named "M4". You can try to callscons --debug=time
, this should give you a better idea about where all the time is spent. Please post the results here (together with the used code of your Builders/Emitters if required)...Total build time: 0.356000 seconds.
For a clean build,Total build time: 25.666000 seconds.
The majority of the time does seem to be taken by my builders; about 1.5 seconds each. I tried deleting the sconsign file as suggested in one of the links you shared, but I can see no appreciable difference. If you can help me to get the in-built m4 builder working, I will try to see if that has any impact on the time.env
that you're trying to use. See #1 of our most-frequently asked FAQ. Also make sure that for yourenv
thePLATFORM
variable isn't set to "WINDOWS". Else SCons thinks its running under Windows and doesn't load them4
tool as default. You'd have to explicitly request it via thetools=['m4']
keyword then, I guess.