0

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)
9
  • How long does an "update" take (everything is built and no changes have been made in between)? Where do the m4 and sed builders come from? The default M4 builder as provided out-of-the-box should be named "M4". You can try to call scons --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)... Mar 6, 2019 at 9:35
  • The m4 and sed builders are my own. I have updated my question with more information.
    – LongTP5
    Mar 7, 2019 at 2:31
  • To answer your other questions @dirkbaechle, for a rebuild, 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.
    – LongTP5
    Mar 7, 2019 at 2:55
  • It looks like you are working under Windows/cygwin? You have to make sure that your "m4" executable can be found in the env that you're trying to use. See #1 of our most-frequently asked FAQ. Also make sure that for your env the PLATFORM variable isn't set to "WINDOWS". Else SCons thinks its running under Windows and doesn't load the m4 tool as default. You'd have to explicitly request it via the tools=['m4'] keyword then, I guess. Mar 7, 2019 at 9:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.