Skip to content

Speed up build time for small changes #7339

@vburenin

Description

@vburenin

User Statement:

At the moment to rebuild a binary of VIC components can take longer time than it really should due to two things:

  1. Dependency generation take around 8 seconds
  2. Rebuilding binary from scratch also incur full binary rebuild which is costly.

On my laptop "make vic-machine" call takes 54 seconds from which 8 seconds is a cache generation and the rest is attempt to build 3 different vic-machine binaries.

Details:
Most of the required time can be drastically reduced if we cache dependency generation and utilize Go 1.10 build cache that caches compiled packages and rebuild only those which have changed.

Acceptance Criteria:
Build time should be shorter at least 5 times. Such result is possible to achieve:

root@0f8631ba6c89:/go/src/github.com/vmware/vic# time make vic-machine
Generating dependency set for cmd/imagec/
Generating dependency set for cmd/vic-machine/
Generating dependency set for cmd/vicadmin/
Generating dependency set for cmd/port-layer-server/
Generating dependency set for cmd/vic-dns/
Generating dependency set for cmd/tether/
Generating dependency set for cmd/vic-ui/
Generating dependency set for cmd/vic-machine-server/
Generating dependency set for cmd/docker/
Generating dependency set for cmd/vic-init/
Generating dependency set for cmd/archive/
Generating dependency set for cmd/rpctool/
Generating dependency set for cmd/gandalf/
building vic-machine linux...
building vic-machine windows...
building vic-machine darwin...

real	0m5.449s
user	0m5.191s
sys	0m2.234s

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions