• Russ Cox's avatar
    cmd/go: cache built packages · de4b6ebf
    Russ Cox authored
    This CL adds caching of built package files in $GOCACHE, so that
    a second build with a particular configuration will be able to reuse
    the work done in the first build of that configuration, even if the
    first build was only "go build" and not "go install", or even if there
    was an intervening "go install" that wiped out the installed copy of
    the first build.
    
    The benchjuju benchmark runs go build on a specific revision of jujud 10 times.
    
    Before this CL:
    
    	102.72u 15.29s 21.98r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	105.99u 15.55s 22.71r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	106.49u 15.70s 22.82r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	107.09u 15.72s 22.94r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	108.19u 15.85s 22.78r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	108.92u 16.00s 23.02r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	109.25u 15.82s 23.05r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	109.57u 15.96s 23.11r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	109.86u 15.97s 23.17r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	110.50u 16.05s 23.37r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    
    After this CL:
    
    	113.66u 17.00s 24.17r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.85u 0.68s 3.49r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.98u 0.72s 3.63r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	4.07u 0.72s 3.57r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.98u 0.70s 3.43r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	4.58u 0.70s 3.58r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.90u 0.70s 3.46r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.85u 0.71s 3.52r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.70u 0.69s 3.64r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    	3.79u 0.68s 3.41r 	 go build -o /tmp/jujud github.com/juju/juju/cmd/jujud ...
    
    This CL reduces the overall all.bash time from 4m22s to 4m17s on my laptop.
    Not much faster, but also not slower.
    
    See also #4719, #20137, #20372.
    
    Change-Id: I101d5363f8c55bf4825167a5f6954862739bf000
    Reviewed-on: https://go-review.googlesource.com/75473
    Run-TryBot: Russ Cox <rsc@golang.org>
    Reviewed-by: default avatarDavid Crawshaw <crawshaw@golang.org>
    de4b6ebf
test.go 34.2 KB