[Feature] FastStream ops could benefit from knowing the data source is indexable
Opened this issue · 0 comments
covers1624 commented
reversed
would not need to allocateskip
andlast
would not need to iterate (potentially) the entire data sourcefirst
andonly
could also benefit by not needing to allocate
We would make any collection stream wrapper, as well as operations which produce a list or array internally, indexable.
A potential performance pitfall would be if first
or only
used an indexer which caused an entire stream to be collected into an array.
first
on reversed
should turn into a last
call on the underlying, rather than allocating
first
on sorted
should be equivalent to limit(1)
which should be equivalent to max
, rather than allocating