问题
I have since long suffered from long startup times when building with SCons. On my old work laptop, it could take up to 60 seconds to just build the most fundamental hello world-example.
I just received a new laptop, so I had the opportunity to investigate this further. Our laptops come preloaded with Visual Studio 2010 and some other stuff. I also need Visual Studio 2015.
On the newly unpacked PC, a build of hello world took "only" 10 seconds (python 2.7.14, scons 3.0.0, no other major applications running)
After installing VS2015, the time went up to 20 seconds.
I can compare this with my 10 year old PC at home, where the same build takes less than 2 seconds (however, only VS2015 there).
What could be the reason for this extreme slowness? Can something be done? It seems like execution of the vcvars scripts and so are responsible. But why so slow on my work computers and not at home? How can I troubleshoot this further?
Ordered by: cumulative time
List reduced from 1104 to 20 due to restriction <20>
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 20.500 20.500 C:\Python27\scons-3.0.0\SCons\Script\Main.py:831(_main)
1 0.000 0.000 20.324 20.324 C:\Python27\scons-3.0.0\SCons\Script\SConscript.py:155(_SConscript)
1 0.000 0.000 20.323 20.323 C:\Temp\SConstruct:1(<module>)
3/2 0.000 0.000 20.321 10.161 C:\Python27\scons-3.0.0\SCons\Environment.py:897(__init__)
3/2 0.000 0.000 20.314 10.157 C:\Python27\scons-3.0.0\SCons\Environment.py:93(apply_tools)
2 0.000 0.000 20.314 10.157 C:\Python27\scons-3.0.0\SCons\Environment.py:1782(Tool)
28/2 0.000 0.000 20.313 10.157 C:\Python27\scons-3.0.0\SCons\Tool\__init__.py:271(__call__)
2 0.000 0.000 20.313 10.157 C:\Python27\scons-3.0.0\SCons\Tool\default.py:38(generate)
2 0.000 0.000 20.150 10.075 C:\Python27\scons-3.0.0\SCons\Tool\mslink.py:256(generate)
8 0.000 0.000 20.150 2.519 C:\Python27\scons-3.0.0\SCons\Tool\MSCommon\vc.py:432(msvc_setup_env_once)
2 0.000 0.000 20.150 10.075 C:\Python27\scons-3.0.0\SCons\Tool\MSCommon\vc.py:531(msvc_setup_env)
2 0.000 0.000 20.149 10.074 C:\Python27\scons-3.0.0\SCons\Tool\MSCommon\vc.py:442(msvc_find_valid_batch_script)
2 0.000 0.000 20.148 10.074 C:\Python27\scons-3.0.0\SCons\Tool\MSCommon\vc.py:381(script_env)
1 0.000 0.000 20.147 20.147 C:\Python27\scons-3.0.0\SCons\Tool\MSCommon\common.py:144(get_output)
12 20.134 1.678 20.134 1.678 {method 'read' of 'file' objects}
1 0.000 0.000 0.173 0.173 C:\Python27\scons-3.0.0\SCons\Script\Main.py:1109(_build_targets)
1 0.000 0.000 0.172 0.172 C:\Python27\scons-3.0.0\SCons\Job.py:100(run)
1 0.000 0.000 0.169 0.169 C:\Python27\scons-3.0.0\SCons\Job.py:186(start)
3 0.000 0.000 0.156 0.052 C:\Python27\scons-3.0.0\SCons\Action.py:644(__call__)
2 0.000 0.000 0.155 0.078 C:\Python27\scons-3.0.0\SCons\Script\Main.py:184(execute)
My SConstruct file:
env = Environment()
hello = Program(["hello.c"])
回答1:
The solution here, according to the chat, was to disable the Antivirus software running on the machine.
With this, the SCons startup time went from 40 to 2 seconds. Also significant performance improvement in other areas could be noticed.
来源:https://stackoverflow.com/questions/50030787/scons-super-slow-startup-in-windows