about summary refs log tree commit diff stats
path: root/makefile
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-08-31 14:56:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-08-31 15:07:03 -0700
commit274ed0fc85e7c50fc0e551c5e376aebdb9a548f4 (patch)
tree96c38529edf951e963a27d19c55caa47133e6c8a /makefile
parent0708d07f905687e38d4b2544117eeccbcda9d539 (diff)
downloadmu-274ed0fc85e7c50fc0e551c5e376aebdb9a548f4.tar.gz
3288 - cleaner heuristic for cleaving
For the last couple of days I've been implicitly thinking in terms of
how many compilation units I want to generate. Might as well make that
explicit and drop the hacky ideas for approximating it.

I tried more timing experiments like the ones in commit 3281.
Conclusion: I can't have the best of both worlds:

  1. Full compilation doesn't take too much longer than with a single
  compilation unit.

  2. Incremental compilation is fast enough that there's negligible
  benefit from dropping optimization.

We're still taking on a 10s hit in full build time.

I care more about not degrading the full compilation too much, since
that gets magnified so much on the Couch's puny server. So we'll just
have to continue using CXXFLAGS=-g when we care to save a few seconds in
incremental compilation time.

A final mystery: the build time increases by 10s with the new heuristic
even though the number of calls to the compiler (and therefore the fixed
cost) is the same. Seems like separating certain functions into
different units is causing the compiler issues. Dropping from 4 to 3
compilation units eliminated the issue.

--- Appendix: Measurements
before:
  full build 4 + test: 42s
  incremental compilation with -O3: varied from 30s for mu_0.cc to 5s for mu_3.cc
    longer times benefitted from dropping -O3

after:
  full build 1 + test: 39s
  full build 2 + test: 41s
  full build 3 + test: 43s
  full build 4 + test: 52s
  full build 5 + test: 53s
  full build 6 + test: 51s
  full build 10 (9) + test: 54s
  full build 20 (16) + test: 58s
Diffstat (limited to 'makefile')
-rw-r--r--makefile5
1 files changed, 5 insertions, 0 deletions
diff --git a/makefile b/makefile
index 86d9fab9..9fb9cad3 100644
--- a/makefile
+++ b/makefile
@@ -14,6 +14,7 @@ core.mu: [0-9]*.mu mu.cc makefile
 	cat $$(./enumerate/enumerate --until zzz |grep '.mu$$') > core.mu
 
 mu_bin: mu.cc makefile function_list test_list cleave/cleave
+	@date
 	@mkdir -p .build
 	@cp function_list test_list .build
 	@mkdir -p .build/termbox
@@ -21,14 +22,17 @@ mu_bin: mu.cc makefile function_list test_list cleave/cleave
 	./cleave/cleave mu.cc .build
 	@# recursive (potentially parallel) make to pick up BUILD_SRC after cleave
 	@make .build/mu_bin
+	@date
 	cp .build/mu_bin .
 
 BUILD_SRC=$(wildcard .build/*.cc)
 .build/mu_bin: $(BUILD_SRC:.cc=.o) termbox/libtermbox.a
+	@date
 	${CXX} ${LDFLAGS} .build/*.o termbox/libtermbox.a -o .build/mu_bin
 
 .build/%.o: .build/%.cc .build/header .build/global_declarations_list
 	@# explicitly state default rule since we added dependencies
+	@date
 	${CXX} ${CXXFLAGS} -c $< -o $@
 
 # To see what the program looks like after all layers have been applied, read
@@ -47,6 +51,7 @@ cleave/cleave: cleave/cleave.cc
 	rm -rf .build
 
 termbox/libtermbox.a: termbox/*.c termbox/*.h termbox/*.inl
+	@date
 	cd termbox && make
 
 # auto-generated files; by convention they end in '_list'.