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

Array reallocation API #8209

Open
jkthorne opened this issue Sep 23, 2019 · 2 comments
Open

Array reallocation API #8209

jkthorne opened this issue Sep 23, 2019 · 2 comments

Comments

@jkthorne
Copy link
Contributor

I think there should be an API for resizing an array. This is useful when you know you are about to insert a large amount of data and you only want one allocation of memory and one memory copy.

This is a followup from a conversation on the array buffer refactor.
#8166 (comment)

Pros:
Gives more flexibility in memory allocations and the potential for performance.

Cons:
More APIs to support and is a more advanced feature.

@rdp
Copy link
Contributor

rdp commented Dec 22, 2021

So you don't know the size when you first create it, I presume? Maybe make resize_to_capacity public?

@beta-ziliani
Copy link
Member

Note: This is already addressed in #11485 (Array#ensure_capacity).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants