Closed Jacalz closed 2 years ago
BenchmarkReadAll-8 7253271 156.3 ns/op 544 B/op 2 allocs/op
BenchmarkReadFull-8 12244660 93.98 ns/op 160 B/op 2 allocs/op
Maybe we should just change this to:
_, err = io.Copy(os.Stdout, msg)
That seems like a wonderful idea. I hadn’t thought about that at all. Will get this updated tomorrow.
I should probably have said something sooner, but this should be ready for a re-review.
I'm just going through and trying to clean up my list of open PRs. Any chance to get this re-reviewed?
Now that we know the length of the text, we can use ReadFull() with a pre-allocated buffer instead. ReadAll always allocates 512 bytes minimum and will append as it goes. We now just allocate just as much as needed and do so once only.
I did this for Rymdport as well and figured that it wouldn't hurt being a good open source citizen and improve it here also :)