about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--cleave/cleave.cc16
-rw-r--r--makefile5
2 files changed, 11 insertions, 10 deletions
diff --git a/cleave/cleave.cc b/cleave/cleave.cc
index 8d79f2ac..442b5fe6 100644
--- a/cleave/cleave.cc
+++ b/cleave/cleave.cc
@@ -38,9 +38,9 @@
 
 // Tune this parameter to balance time for initial vs incremental build.
 //
-//   Larger numbers -> larger/fewer compilation units -> faster initial build
-//   Smaller numbers -> smaller compilation units -> faster incremental build
-int Compilation_unit_size = 200;
+//   decrease value -> faster initial build
+//   increase value -> faster incremental build
+int Num_compilation_units = 3;
 
 #include<assert.h>
 #include<cstdlib>
@@ -115,7 +115,9 @@ size_t slurp_some_functions(const vector<string>& in, size_t start, vector<strin
     out.push_back("#include \"global_declarations_list\"");
   out.push_back("");
   size_t curr = start;
-  for (int i = 0; i < Compilation_unit_size; ++i) {
+  while (true) {
+    if (curr >= in.size()) break;
+    if (out.size() >= in.size()/Num_compilation_units) break;
     while (curr < in.size()) {
       // read functions -- lines until unindented '}'
       while (curr < in.size()) {
@@ -137,12 +139,6 @@ size_t slurp_some_functions(const vector<string>& in, size_t start, vector<strin
     }
     try_return:;
   }
-
-  // Idea: Increase the number of functions to include in the next call to
-  // slurp_some_functions.
-  // Early functions are more likely to be larger because later layers added
-  // to them.
-//?   Compilation_unit_size *= 1.5;
   return curr;
 }
 
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'.