Skip to content

ToArray with pre-allocated slices: ToExistingArray #473

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

Merged
merged 5 commits into from
Apr 8, 2025

Conversation

TheHippo
Copy link
Contributor

@TheHippo TheHippo commented Apr 8, 2025

I have a use case were I need to call ToArray quite often. Every call creates a new slices which creates a lot of pressure for Go's GC. This PR adds a new function - ToExistingArray - to Bitmap which allows using a pre-allocated slice, that later can be re-used.

@lemire
Copy link
Member

lemire commented Apr 8, 2025

Running tests

@lemire
Copy link
Member

lemire commented Apr 8, 2025

Will be part of the next release.

@lemire lemire merged commit 46b0acf into RoaringBitmap:master Apr 8, 2025
8 checks passed
@d-enk
Copy link

d-enk commented May 20, 2025

As if it were possible to do without a pointer to a slice 🤔

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.

3 participants