RubenVerborgh / AsyncIterator

An asynchronous iterator library for advanced object pipelines in JavaScript
https://rubenverborgh.github.io/AsyncIterator/docs/
Other
48 stars 7 forks source link

Performance: Improve performance of `append` and `prepend` #67

Open jeswr opened 2 years ago

jeswr commented 2 years ago

See use case for append in #66 .

append and prepend still go through the SimpleTransformIterator

IMO the cleanest way to do this would be to add a parameter to the UnionIterator in #65 that requires the iterators in the union to be consumed sequentially, and then for append and prepend to just return a union of the current source, and the data to append/prepend.

@jacoscaz - do you have any thoughts on this?

jacoscaz commented 2 years ago

IMHO this is a (very) good idea, although I'm unsure as to how complex the final solution might be. Could be worth having a SequentialUnion iterator if having everything in one class becomes too much.