Skip to content

Commit

Permalink
One weird trick to speed up your imports.
Browse files Browse the repository at this point in the history
Setting the `build.FindOnly` flag when calling `context.Import`
drastically speeds up parsing, especially when accessing remove file
systems (e.g.  nfs). Tests are still running and everything seems fine
so far, hopefully nothing relies on anything other than `p.PkgObj`, so
we should be fine.
  • Loading branch information
tiziano88 committed Aug 29, 2014
1 parent 9b760fd commit e619b27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion declcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func find_global_file(imp string, context build.Context) (string, bool) {
return "unsafe", true
}

p, err := context.Import(imp, "", build.AllowBinary)
p, err := context.Import(imp, "", build.AllowBinary|build.FindOnly)
if err == nil {
if g_config.Autobuild {
autobuild(p)
Expand Down

0 comments on commit e619b27

Please sign in to comment.