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

don't shrink_to_fit on large changesets #5617

Closed
wants to merge 1 commit into from
Closed

don't shrink_to_fit on large changesets #5617

wants to merge 1 commit into from

Conversation

ironage
Copy link
Contributor

@ironage ironage commented Jun 24, 2022

After #5614 I did a code search for reserve, and I found this other place using the same pattern. When a client is creating a large (> 1024 byte) changeset with many small strings, we don't want to incur the cost of shrink_to_fit. Although this didn't show up in any profiling, it seems to me it could be problematic in the same way.

@ironage ironage requested review from jbreams and tgoyne June 24, 2022 20:51
@ironage ironage self-assigned this Jun 24, 2022
@cla-bot cla-bot bot added the cla: yes label Jun 24, 2022
@jbreams
Copy link
Contributor

jbreams commented Jun 24, 2022

I don't mind this change, but m_buffer in this case is an AppendBuffer whose reserve() method Does The Right Thing™️.

@tgoyne
Copy link
Member

tgoyne commented Jun 24, 2022

m_buffer here is an AppendBuffer, which does something very different from the standard library types in reserve(). AppendBuffer:reserve() is actually "ensure there is at least this many bytes free, growing the buffer exponentially if needed".

@ironage
Copy link
Contributor Author

ironage commented Jun 24, 2022

Ah yes, good eye. This change is not needed then. Thanks!

@ironage ironage closed this Jun 24, 2022
@ironage ironage deleted the js/reserve branch June 24, 2022 20:58
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants