leonhd / unladen-swallow

Automatically exported from code.google.com/p/unladen-swallow
Other
1 stars 1 forks source link

Incremental make rebuilds too much #115

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
After r981, all .cc files are being recompiled during an incremental remake. 
This is causing a huge increase in incremental build times.

Typical CPython 2.6.4 rebuild after touching listobject.c:

real    0m1.437s
user    0m1.239s
sys     0m0.198s

Typical US trunk rebuild after touching listobject.c:

real    0m24.416s
user    0m22.475s
sys     0m1.912s

Original issue reported on code.google.com by collinw on 13 Jan 2010 at 12:28

GoogleCodeExporter commented 8 years ago
Considering these lines:

@@ -456,7 +437,7 @@
.PHONY: llvm
ifeq (@BUILD_LLVM@, 1)
llvm:
-   $(MAKE) -C Util/llvm tools-only ONLY_TOOLS="clang opt llvm-link llvm-dis"
+   $(MAKE) -C Util/llvm tools-only ONLY_TOOLS="clang opt llvm-link llvm-dis 
llvm-config"
else
llvm: ;
endif
@@ -464,13 +445,19 @@
# Declare some of LLVM's build outputs to depend on LLVM.  We only
# declare the ones that other files need to depend on.
$(LLVM_BIN_DIR)/clang $(LLVM_BIN_DIR)/opt $(LLVM_BIN_DIR)/llvm-link \
-   $(LLVM_BIN_DIR)/llvm-dis $(LLVM_LIB_PATHS) \
+   $(LLVM_BIN_DIR)/llvm-dis $(LLVM_CONFIG) $(LLVM_LIB_PATHS) \
    $(LLVM_INC_DIR)/llvm/Intrinsics.gen: llvm
@@ -1240,8 +1216,8 @@
.c.o:
    $(CC) -c $(PY_CFLAGS) -o $@ $<

-%.o: %.cc $(LLVM_INC_DIR)/llvm/Intrinsics.gen
-   $(CXX) -c $(LLVMCXXFLAGS) $(PY_CXXFLAGS) -o $@ $<
+%.o: %.cc $(LLVM_INC_DIR)/llvm/Intrinsics.gen $(LLVM_CONFIG)
+   $(CXX) -c $(LLVM_CXXFLAGS) $(PY_CXXFLAGS) -o $@ $<

I'm not entirely certain, but I think this may have something to do with the 
*.cc files eventually depending on a phony[1] target; that is, a 
target which is *always* rebuilt. I'd suggest checking if using an order-only 
prerequisites[2] solves it, like this:

%.o: %.cc | …

The difference in semantics is that an order-only prerequisite is guaranteed to 
be built *before* the target itself, but cannot invalidate it.

[1] 
<http://www.gnu.org/software/make/manual/html_node/Phony-Targets.html#Phony-Targ
ets>
[2] 
<http://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html#Prere
quisite-Types>

Original comment by danchr on 13 Jan 2010 at 1:48

GoogleCodeExporter commented 8 years ago

Original comment by collinw on 14 Jan 2010 at 12:14

GoogleCodeExporter commented 8 years ago
Reid worked up a patch for this: http://codereview.appspot.com/190046/show

Original comment by collinw on 20 Jan 2010 at 9:08

GoogleCodeExporter commented 8 years ago
This was fixed in r1015.

New trunk@1024 incremental builds after touching listobject.c:

0m6.680s
0m5.310s
0m7.639s

Still slower, but that's from statically linking LLVM, which is a separate 
issue.

Nice work, Reid.

Original comment by collinw on 21 Jan 2010 at 9:41