perf icon indicating copy to clipboard operation
perf copied to clipboard

benchstat: accept io.Writer in FormatHTML, not *bytes.Buffer

Open nvb opened this issue 5 years ago • 1 comments

This brings the API in-line with that of FormatText and FormatCSV and allows it to be used without necessitating an intermediate buffer. The change is fully backwards compatible and doesn't impose any potential performance cost because html.Template.Execute accepts an io.Writer, so any bytes.Buffer passed by reference to FormatHTML was already being forced to escape onto the heap.

This might have been done this way to avoid questions about how the function should handle errors from Writer, but we already ignore those questions and panic in FormatCSV, so it seems reasonable that we would do the same thing here.

nvb avatar Dec 14 '19 00:12 nvb

This PR (HEAD: c5a59e87efa6fb7a1ba8f45110def5e5cec8f6c8) has been imported to Gerrit for code review.

Please visit https://go-review.googlesource.com/c/perf/+/211320 to see it.

Tip: You can toggle comments from me using the comments slash command (e.g. /comments off) See the Wiki page for more info

gopherbot avatar Dec 14 '19 00:12 gopherbot