-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Passing a pooled array to HashSet/StreamAdd and similar methods. #2027
Comments
Yes, this is indeed a limitation currently. We should probably add an API that allows a Let's see if we can start a list of likely candidates; perhaps strong case:
maybe?
meh...?
others? |
Can something similar be done for the |
See StringGetLease - that's similar but related, has overlapping API surface |
Yes been using StringGetLease for a while now, would be good to expand it to others, I have many usecases some with largish arrays which would benefit from this... |
Is this something that I can contribute to? (assuming you are focusing on other stuff) |
I have a usecase where allocations need to be minimized and there are scenarios where I get a
T[]
as an input that needs to be converted to eitherNameValueEntry[]
orHashEntry[]
before I can invoke StreamAdd() or HashSet().One way to tackle this would be to create a buffer using the ArrayPool e.g.
However given that the
buffer.Length
returned by the pool is not necessarily same as the requestedincoming.Length
there is no way for me to indicate how many items StreamAdd()/HashSet() should take.Would it be possible to create an overload which could support this?
The text was updated successfully, but these errors were encountered: