-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Go compiler rarely does a good job at removing the interfaces overhead.
Here is an example:
func f(buf *bytes.Buffer) {
var rw io.ReadWriter = b
g(rw) // performs convI2I
}
//go:noinline
func g(r io.Reader) {}
Fixed code:
func f(buf *bytes.Buffer) {
var rw = b // just use *bytes.Buffer directly
g(rw) // cheaper conversion
}
//go:noinline
func g(r io.Reader) {}
Investigation needed: how often can we improve things?
cristaloleg
Metadata
Metadata
Assignees
Labels
No labels