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/+/193260Reviewed-by: Jeremy Faller <jeremy@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
Showing
Please register or sign in to comment