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

Do not reserve exponentially growing margin #130

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

jakobnissen
Copy link
Collaborator

In fde7eea, buffers were changed to growing exponentially by calling makemargin!(buf, X) with an exponentially growing X. However, this is not the right way of solving the problem. Indeed, only a single byte of margin is necessary when removing already-used data from the buffer. Requiring exponentially increasing margins forces unneeded buffer resizes.

Instead, makemargin! itself should exponentially increase buffersize when it finds that it can't make enough margin, and the callers of makemargin! should request only 1 byte of space, as before.

In fde7eea, buffers were changed to growing exponentially by calling
`makemargin!(buf, X)` with an exponentially growing X. However, this is not the
right way of solving the problem. Indeed, only a single byte of margin is
necessary when removing already-used data from the buffer. Requiring
exponentially increasing margins forces unneeded buffer resizes.

Instead, `makemargin!` itself should exponentially increase buffersize when it
finds that it can't make enough margin, and the callers of `makemargin!` should
request only 1 byte of space, as before.
@quinnj quinnj merged commit de62b63 into JuliaIO:master Jan 9, 2023
@jakobnissen jakobnissen deleted the bufferfix branch January 9, 2023 15:15
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.

2 participants