1 |
Hi All, |
2 |
|
3 |
Thought some people may be interested in this email from the dietlibc |
4 |
mailing list. This is one of the reasons we don't use "make" for our |
5 |
ports system. |
6 |
|
7 |
----- Forwarded message from Felix von Leitner <leitner@××××.de> ----- |
8 |
|
9 |
To: dietlibc@××××.de |
10 |
Date: Mon, 18 Jun 2001 22:45:47 +0200 |
11 |
From: Felix von Leitner <leitner@××××.de> |
12 |
Subject: Why make(1) sucks |
13 |
|
14 |
If you compile the diet libc frequently, you probably noticed that |
15 |
running make takes over one second before even running any command. |
16 |
If you look at the Makefile, you will notice that it contains a lot of |
17 |
dynamic features like wildcard and patsubst and a long list of VPATHs. |
18 |
So I assumed that these were the parts that ate all the time and wrote a |
19 |
perl script that a) removes the wildcards and patsubsts by expanding |
20 |
them in-line and b) computing the dependencies statically and stating |
21 |
them explicitly. |
22 |
|
23 |
I checked in that script as contrib/static.pl. It will write the new |
24 |
Makefile to sMakefile. I expected a noticeable performance increase in |
25 |
make after the first part was done (remove wildcard and patsubst), but |
26 |
the pause increased to 7.5 seconds on my Athlon 900. Huh? |
27 |
|
28 |
Well, maybe the VPATHs are the part that takes so long, I thought, so I |
29 |
added the b) part. The pause decreased to 7.0 seconds. I couldn't |
30 |
believe it and put the dynamic wildcard and patsubst part back in, and |
31 |
now make again takes 1 second. Adding a syntax error in the end |
32 |
revealed that make apparently takes one full second to parse the |
33 |
Makefile! |
34 |
|
35 |
Switching to a perl script would increase performance tenfold! |
36 |
This can't be true, can it? |
37 |
|
38 |
So I did an strace and found out that every occurrance of $(OBJDIR) |
39 |
prompted make to recalculate $(ARCH), i.e. run uname and sed! |
40 |
|
41 |
Now that I see why make sucks, I'm working on a solution. The obvious |
42 |
solution is to simply run make again setting MYARCH to something. When |
43 |
I do that with the static dependencies, make takes 0.08 seconds to |
44 |
notice that it does not have to do anything. |
45 |
|
46 |
Felix |
47 |
|
48 |
|
49 |
----- End forwarded message ----- |
50 |
|
51 |
-- |
52 |
Daniel Robbins <drobbins@g.o> |
53 |
President/CEO http://www.gentoo.org |
54 |
Gentoo Technologies, Inc. |