Skip to content

cmd/go: go mod download -json is a lot slower with go1.13Β #34533

@hyangah

Description

@hyangah

The feature requested in #32239 was added to go1.13 (per https://golang.org/cl/183841).
That makes the go mod download -json command populates the Latest boolean field of the json output by performing an extra query to check the latest version of the module.

It turned out the overhead of this extra query is significant in some cases,
especially when the module has many incompatible versions tags. E.g. 'k8s.io/kubernetes' or 'github.com/openshift/origin'.

$ GOPATH=`mktemp -d` GOPROXY=direct GONOSUM=* time  ~/go/bin/go1.13 mod download -json github.com/openshift/[email protected]
go: finding github.com/openshift/origin v1.3.0-alpha.0
go: finding github.com/openshift/origin v4.1.0+incompatible
...
154.54user 9.60system 1:42.54elapsed 160%CPU (0avgtext+0avgdata 482292maxresident)k
112inputs+2314104outputs (0major+229264minor)pagefaults 0swaps

$ GOPATH=`mktemp -d` GOPROXY=direct GONOSUM=* time  ~/go/bin/go1.13beta1 mod download -json github.com/openshift/[email protected]
go: finding github.com/openshift/origin v1.3.0-alpha.0
...
12.01user 1.62system 0:15.11elapsed 90%CPU (0avgtext+0avgdata 130020maxresident)k
360inputs+414112outputs (0major+18928minor)pagefaults 0swaps

This is a huge regression compared to the benefit from the new functionality.
Let's consider to provide an option to disable, or disable it by default if optimizing the 'latest' query is non trivial.

@bcmills @jayconrod @katiehockman @heschik

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions