]> Cypherpunks repositories - gostls13.git/commit
[dev.link] cmd/link/internal/loader: add 1-element object cache for use in toLocal
authorThan McIntosh <thanm@google.com>
Wed, 30 Oct 2019 14:14:33 +0000 (10:14 -0400)
committerThan McIntosh <thanm@google.com>
Thu, 31 Oct 2019 01:04:59 +0000 (01:04 +0000)
commite90e6e75f8f0b06a5b0c9c68d8d98b8f37b0d3e0
treedda4e479a1b1a5772bb320de961065894750a72c
parentd77b809df908d81406ceced91fe1b1399f1e29f1
[dev.link] cmd/link/internal/loader: add 1-element object cache for use in toLocal

To speed up the loader.Loader.toLocal() method, cache the index of the
most recently accessed object file and check that object's sym range
in toLocal() before doing a full binary search over all object symbol
ranges. This speeds up relink of kubernetes/hyperkube by about 2%, and
improves compilebench (relative to the dev.link branch) by about 5%:

name                      old time/op       new time/op       delta
LinkCompiler                    1.62s ± 8%        1.50s ± 9%  -7.21%  (p=0.000 n=20+19)
LinkWithoutDebugCompiler        1.13s ± 8%        1.09s ±12%    ~     (p=0.052 n=20+20)

name                      old user-time/op  new user-time/op  delta
LinkCompiler                    1.94s ±18%        1.97s ±16%    ~     (p=0.813 n=19+20)
LinkWithoutDebugCompiler        1.15s ±16%        1.13s ±12%    ~     (p=0.547 n=20+20)

Change-Id: Id5a8a847b533858373c0462f03972d436eda6748
Reviewed-on: https://go-review.googlesource.com/c/go/+/204337
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/link/internal/loader/loader.go