summaryrefslogtreecommitdiffstats
path: root/src/build_log.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-05-18 05:35:34 (GMT)
committerEvan Martin <martine@danga.com>2011-05-22 16:26:06 (GMT)
commitdf4c0d6ab9cb81673fd6b104ad024d155ff8472d (patch)
tree0da1a90654d525e6a9f9ca11a49d279f464b1b55 /src/build_log.cc
parentba75e87f25e6355a12377c1d2311568e68fa7739 (diff)
downloadNinja-df4c0d6ab9cb81673fd6b104ad024d155ff8472d.zip
Ninja-df4c0d6ab9cb81673fd6b104ad024d155ff8472d.tar.gz
Ninja-df4c0d6ab9cb81673fd6b104ad024d155ff8472d.tar.bz2
don't recompact log often for small programs
Diffstat (limited to 'src/build_log.cc')
-rw-r--r--src/build_log.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/build_log.cc b/src/build_log.cc
index 2a99cb4..3073f7f 100644
--- a/src/build_log.cc
+++ b/src/build_log.cc
@@ -170,11 +170,15 @@ bool BuildLog::Load(const string& path, string* err) {
entry->command = string(start, end - start);
}
- // Mark the log as "needs rebuiding" if it has kCompactionRatio times
- // too many log entries or it's the wrong version.
+ // Decide whether it's time to rebuild the log:
+ // - if we're upgrading versions
+ // - if it's getting large
+ int kMinCompactionEntryCount = 100;
int kCompactionRatio = 3;
- if (total_entry_count > unique_entry_count * kCompactionRatio ||
- log_version < kCurrentVersion) {
+ if (log_version < kCurrentVersion) {
+ needs_recompaction_ = true;
+ } else if (total_entry_count > kMinCompactionEntryCount &&
+ total_entry_count > unique_entry_count * kCompactionRatio) {
needs_recompaction_ = true;
}