to answer your earlier question: no there is no //-inline or #pragma inline or any user control over inlining. one '-l' lets you /disable/ inlining, repeating it more often is deliberately undocumented in the help text, and explicitly warned against in the code.

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.

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 7 of 7 | next ›
Discussion Overview
groupgolang-nuts @
postedSep 25, '15 at 9:46a
activeSep 27, '15 at 7:25p



site design / logo © 2023 Grokbase