Skip to content

Conversation

@emersion
Copy link
Contributor

@emersion emersion commented Feb 5, 2026

binary.Read always reads exactly 2 bytes when decoding a uint16.

binary.Read always reads exactly 2 bytes when decoding a uint16.
Copy link
Owner

@pires pires left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one <3

Avoids allocating the io.LimitedReader on every connection, and now reads directly from the bufio.Reader (which implements io.ByteReader), allowing for potentially faster single-byte reads if binary.Read takes the optimized path.

@pires pires merged commit ef82c3b into pires:main Feb 5, 2026
8 checks passed
@emersion emersion deleted the unnecessary-limited-reader branch February 5, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants