Skip to content

ToArray with pre-allocated slices: ToExistingArray#473

Merged
lemire merged 5 commits intoRoaringBitmap:masterfrom
TheHippo:reusable-slices
Apr 8, 2025
Merged

ToArray with pre-allocated slices: ToExistingArray#473
lemire merged 5 commits intoRoaringBitmap:masterfrom
TheHippo:reusable-slices

Conversation

@TheHippo
Copy link
Copy Markdown
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
Copy Markdown
Member

lemire commented Apr 8, 2025

Running tests

@lemire
Copy link
Copy Markdown
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
Copy Markdown

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