Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MinGW "make" starts very slowly

After some pain and suffering, i managed to install everything necessary for MinGW to work on a computer not on the network.

It worked nicely for a couple days, but now I'm experiencing very long delays before anything starts to happen after i give the "make" command to build my project.

I tried disabling the network, as suggested here: Why is MinGW very slow? But it didn't help.

Note that it's not the actual compilation / linking progress that is slow, but the startup of those processes seems to take forever. 5-10 minutes. Except if i just did it, then it starts in 10-30 seconds.

I know, it used to take a lot longer to load those tapes on Commodore, but over the years I have grown impatient.

Any ideas?

like image 210
0xbaadf00d Avatar asked Dec 20 '11 06:12

0xbaadf00d


People also ask

Why is MinGW so slow?

Many "unixy" things on MinGW are painfully slow, because Windows has no fork() . Windows only has CreateProcess() , which is quite different. Unix shells and GNU Make do a lot of forking, so running these under MinGW results in "emulated" forks, which are really slow.

Why is Msys slow?

The root causes are that GNU make (which IDF currently uses for its build system) does a lot of fork() operations and also does a lot of scanning of the filesystem. These two operations are fast in Linux/OSX but slow in Windows. Plus, MSYS itself is a translation layer which adds some overhead.


1 Answers

Try doing make -r (without implicit rules). For me it was a difference between 30 seconds and fraction of a second for single cpp file.

Explanation:

I've had the same problem MinGW make long ago. I've used make -d to investigate. It was then obvious that make uses a gazillion of implicit rules for every dependency file - if my file had dep on shared_ptr.hpp then make checked for shared_ptr.hpp(o|c|cc|v|f|r|.. and dozens other combinations). Of course those files didn't exist. It looks like checking for file mod time/existence (when it doesn't really exist) on Windows platform is a lot slower than on Linux (becouse with Linux i didn't see any difference with/without -r switch).

like image 91
Piotr Niemcunowicz Avatar answered Sep 27 '22 16:09

Piotr Niemcunowicz