Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement on nonblocking sockets #837

Closed
wants to merge 16 commits into from

Conversation

misalcedo
Copy link
Contributor

@misalcedo misalcedo commented Nov 21, 2023

The goal of this change is to further reduce the allocations and system calls for a small number of bytes. By fully consuming the read buffer before reading more bytes, we can avoid making system calls to request less than max_length bytes.

In order to handle the streaming with a response block cases, I had to add a block argument to Socket#read. This allowed me to denote whether I wanted to wait for bytes to be avialable or not. That together with a new Socket#read_chunk that tries to read a full chunk_size bytes helped me get tests passing.

@misalcedo misalcedo closed this Nov 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant