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:
parent
22501a76a1
commit
6e2f52e572
|
@ -95,9 +95,14 @@ func Build(ctxt *build.Context) (forward, reverse Graph, errors map[string]error
|
||||||
// absolutize resolves an import path relative
|
// absolutize resolves an import path relative
|
||||||
// to the current package bp.
|
// to the current package bp.
|
||||||
// The absolute form may contain "vendor".
|
// The absolute form may contain "vendor".
|
||||||
// TODO(adonovan): opt: experiment with
|
//
|
||||||
// overriding the IsDir method with a caching version
|
// The vendoring feature slows down Build by 3×.
|
||||||
// to avoid a huge number of redundant I/O calls.
|
// 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 }
|
absolutize := func(path string) string { return path }
|
||||||
if buildutil.AllowVendor != 0 {
|
if buildutil.AllowVendor != 0 {
|
||||||
memo := make(map[string]string)
|
memo := make(map[string]string)
|
||||||
|
|
Loading…
Reference in New Issue