]> Cypherpunks repositories - gostls13.git/commit
cmd/link: memoize/cache whether plugin.Open symbol available
authorThan McIntosh <thanm@google.com>
Wed, 4 Sep 2019 15:25:06 +0000 (11:25 -0400)
committerThan McIntosh <thanm@google.com>
Fri, 6 Sep 2019 12:16:32 +0000 (12:16 +0000)
commitb1a20253fe8a1f099a23735c9a613b433df67261
treee2b1e5cc57c0b7afccfa5047afa6ca684d01e83e
parentc7dc5e92ddb7c6d4e71edd7f24f9314e81a8413b
cmd/link: memoize/cache whether plugin.Open symbol available

Perform a single lookup of "plugin.Open" at the point where we set the
loaded flag for the context, then cache whether the result is nil, so
that we can consult this cached value later on (instead of having to
look up the symbol each time). This helps speed up the DynLinkingGo()
context method, which is called from within some very hot loops in the
linker (when linking 'hyperkube' from kubernetes, reduces total calls
to "sym.(*Symbols).ROLookup" from 6.5M to 4.3M)

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