summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-10-28 19:49:21 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-10-28 19:49:21 (GMT)
commit1bc97ccf9382b182042769e8322c94f0dcaba724 (patch)
treeac3e9acd09ce636d2028a54f2abbf476cd5fc46c
parent7b1768b1be2f97495fa8828f1f9e80b0b2f395a4 (diff)
downloadeeshow-1bc97ccf9382b182042769e8322c94f0dcaba724.zip
eeshow-1bc97ccf9382b182042769e8322c94f0dcaba724.tar.gz
eeshow-1bc97ccf9382b182042769e8322c94f0dcaba724.tar.bz2
file/git-file.c (vcs_git_time): only retrieve time if we may use it (HACK)
Rough performance comparison: eeplot HEAD:neo900.pro -o neo900.pdf Without -d 0.750 s -d "%s", search until blob no longer in tree 1.40 min (x 112) -d "%s", search to bottom 21 min (x 15)
-rw-r--r--Makefile1
-rw-r--r--file/git-file.c16
2 files changed, 16 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 237b6f7..d573d29 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,7 @@ EEDIFF_OBJS = main/eediff.o main/common.o \
$(OBJS_MISC)
EETEST_OBJS = main/eetest.o main/common.o \
kicad/sexpr.o \
+ kicad/pl-render.o gfx/gfx.o gfx/text.o gfx/misc.o \
gui/fmt-pango.o \
$(OBJS_FILE) \
$(OBJS_MISC)
diff --git a/file/git-file.c b/file/git-file.c
index a03a7a7..1593115 100644
--- a/file/git-file.c
+++ b/file/git-file.c
@@ -547,13 +547,27 @@ static void recurse_time(const git_commit *commit, const git_oid *oid,
}
+#include "kicad/pl.h"
+
+
time_t vcs_git_time(void *ctx)
{
const struct vcs_git *vcs_git = ctx;
const git_oid *oid = git_object_id(vcs_git->obj);
time_t t = 0;
- recurse_time(vcs_git->commit, oid, &t);
+ /*
+ * @@@ Retrieving time from git is rather slow, so we only do it if
+ * there is any chance we'll actually need it.
+ *
+ * What would be better solutions:
+ * - make the search more efficient (e.g., by avoiding searching the
+ * ancestry of merges multiple times),
+ * - cache results,
+ * - lazy evaluation.
+ */
+ if (date_override)
+ recurse_time(vcs_git->commit, oid, &t);
return t;
}