From 6e2f52e572ea836c54886d4856872cf239800498 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Wed, 30 Dec 2015 15:24:19 -0500 Subject: [PATCH] refactor/importgraph: document some optimization experiments Change-Id: I5ea8f097814cd83a8534be1bfbeda4ebdabee168 Reviewed-on: https://go-review.googlesource.com/18216 Reviewed-by: Alan Donovan --- refactor/importgraph/graph.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/refactor/importgraph/graph.go b/refactor/importgraph/graph.go index fc8691d019..8a833dd27c 100644 --- a/refactor/importgraph/graph.go +++ b/refactor/importgraph/graph.go @@ -95,9 +95,14 @@ func Build(ctxt *build.Context) (forward, reverse Graph, errors map[string]error // absolutize resolves an import path relative // to the current package bp. // The absolute form may contain "vendor". - // TODO(adonovan): opt: experiment with - // overriding the IsDir method with a caching version - // to avoid a huge number of redundant I/O calls. + // + // The vendoring feature slows down Build by 3×. + // Here are timings from a 1400 package workspace: + // 1100ms: current code (with vendor check) + // 880ms: with a nonblocking cache around ctxt.IsDir + // 840ms: nonblocking cache with duplicate suppression + // 340ms: original code (no vendor check) + // TODO(adonovan): optimize, somehow. absolutize := func(path string) string { return path } if buildutil.AllowVendor != 0 { memo := make(map[string]string)