Why is configure so slow in MSYS?
Asked Answered
G

3

18

When I use MSYS to compile something, the ./configure step can take longer than the make. However, the same process in Linux has a fast configure and slow make. Is this just some setting in MSYS that is bogging down my system? Does anyone have a solution?

Gazo answered 13/2, 2010 at 2:7 Comment(0)
M
22

Typical configure scripts do a lot of starting small subprocesses. On Unix-like operating systems, this is done with the fork() and exec() function calls, which have very particular semantics that need to be preserved (for example, copy-on-write shared memory after forking). On Windows, subprocesses are created with CreateProcess() which has very different semantics (eg. completely separate memory space from the parent). In order to execute Unix-like scripts and programs correctly, MSYS needs to do a lot of emulation work to make creating new processes on Windows work like fork()/exec() on Unix. This ends up being slower than an OS that offers those function calls natively.

Midshipman answered 13/2, 2010 at 2:52 Comment(2)
It's actually not that bad to CreateProcess on windows. I think cygwin tries to emulate fork on windows which makes it insanely slow. If bash was not using fork (my guess that it uses fork, but I didn't check) to start processes then configure would run just as fast. On my i7 box when I was trying to fix this "problem" it appeared that cygwin can fork only a few times per second. A way to test speed of fork: while (true); do date; done | uniq -cQuirt
+1 Pavel .. uclinux had the same issue it can run without an MMU and anything with fork used a very slow full copyMarkley
F
0

You may also want to turn off any virus scanners you have running. They will re-scan an executable every time it is loaded, which absolutely kills script performance.

Even if you don't have anti-virus running, don't forget about Windows Defender. (You may also want to disable User Account Control, though I don't know what impact that has on program load time.)

Frisch answered 12/10, 2010 at 18:25 Comment(0)
D
0

A lot of disk access is involved, which IMHO slows things down a lot. For example configure creates temporary source code to be compiled as part of the tests it performs. This creates an object file that has to be deleted again. What I do to speed up configure is extract the source I want to build on a RAM drive and configure and compile it there. I recommend using ImDisk (http://www.ltr-data.se/opencode.html/#ImDisk) which is free.

Dimphia answered 3/1, 2013 at 9:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.