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

Span<T> Memory<T> support linq #26082

Closed
grahamehorner opened this issue May 4, 2018 · 5 comments
Closed

Span<T> Memory<T> support linq #26082

grahamehorner opened this issue May 4, 2018 · 5 comments
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Linq
Milestone

Comments

@grahamehorner
Copy link

It would be great if the Span Memory supported linq;

IMHO this would improve the developer experience when slicing/dicing
data while preventing heap allocations

@stephentoub
Copy link
Member

while preventing heap allocations

It's quite rare to hear someone talk about using LINQ to avoid heap allocations. Can you clarify how that would work?

@grahamehorner
Copy link
Author

I was thinking eg. a where, orderby could return a linked list of pointers to the readonly span/memory; but not sure if it possible ?

@stephentoub
Copy link
Member

That would require allocations.

@stephentoub
Copy link
Member

If someone wants to use LINQ with Memory<T>, they can do so via MemoryMarshal.ToEnumerable(). Given that, I'm going to close this. Thanks.

@NN---
Copy link
Contributor

NN--- commented Aug 2, 2020

You can use eager computations for Span using LinqFaster https://github.com/jackmott/LinqFaster

@ghost ghost locked as resolved and limited conversation to collaborators Dec 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Linq
Projects
None yet
Development

No branches or pull requests

4 participants