-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.Performancehelp wantedrelease-blocker
Milestone
Description
What version of Go are you using (go version)?
1.9beta1
What did you do?
In my code, I'm implementing fmt.Formatter.
In order to write a string to the fmt.State, I'm calling io.WriteString().
I know that this function has an optimization that allows to call WriteString() if w implements it.
Sadly, in my case the "real" type of fmt.State is fmt.pp.
fmt.pp only has Write().
What did you expect to see?
I think we should add:
func (p *pp) WriteString(s string) (ret int, err error) {
p.buf.WriteString(s)
return len(s), nil
}in my case, it greatly improve performance and reduces memory allocation.
We could also implement WriteByte() and WriteRune(), since fmt.buffer has these methods.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.Performancehelp wantedrelease-blocker