this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

encoding/gocode: use many fewer go/packages.LoadMode bits

We just need a package's name and type information.
We don't need its syntax nor do we need to load dependencies,
both of which multiply the cost of go/packages.

`go generate` for encoding/gocode drops from ~1.55s to ~0.45s
on my laptop after this change, which should help CI.
Currently, its `go generate ./...` step with a warm Go cache
is one of the slowest, clocking in at 12s.
Slow generation steps are particularly harmful as they are sequential.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I06cc023bedfee5cadf5313cf001b35bce9f41af3
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1201336
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>

+1 -1
+1 -1
encoding/gocode/generator.go
··· 109 109 pkgName := inst.Value().BuildInstance().PkgName 110 110 if pkgPath != "" { 111 111 loadCfg := &packages.Config{ 112 - Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedTypes | packages.NeedTypesSizes | packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedDeps, 112 + Mode: packages.NeedName | packages.NeedTypes | packages.NeedTypesInfo, 113 113 } 114 114 pkgs, err := packages.Load(loadCfg, pkgPath) 115 115 if err != nil {