The reason transitive inlining isn't there is because runtime.Caller's current implementation could not handle that. I have no idea where it is on the agenda.
to come back to your overall point: your peek is about as fast as it is going to be, but if your program spends 30% of its time in there, maybe you can expose the current unread size, and read up to that into a buffer. E.g. bufio.Reader allows exactly that with .Buffered(), and it's Peek() looks a lot like yours.
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.