1
0
mirror of https://github.com/golang/go synced 2024-11-18 06:14:46 -07:00

refactor/importgraph: document some optimization experiments

Change-Id: I5ea8f097814cd83a8534be1bfbeda4ebdabee168
Reviewed-on: https://go-review.googlesource.com/18216
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Alan Donovan 2015-12-30 15:24:19 -05:00
parent 22501a76a1
commit 6e2f52e572

View File

@ -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)