RubenVerborgh/AsyncIterator

optimization: Implement UnionIterator without buffering

Opened this issue · 1 comments

jeswr commented

In the UnionIterator I don't see the necessity of buffering elements; since, unless you are taking a union over a huge number of iterators, the cost of testing all the unterminated iterators to see if they have an element available is likely it be an inexpensive operation; and thus should just happen on the read call; rather than in _read on a BufferedIterator. (I was just working on the Comunica reasoning components which has a lot of unions in the naive algorithm for reasoning - so I suspect it is causing some overhead there)

jeswr commented

Similar with the multiTransformIterator (should buffer the transformers but not their elements, ..., I think). The main downstream effects would be at https://github.com/comunica/asyncjoin/blob/main/join/DynamicNestedLoopJoin.js and https://github.com/comunica/asyncjoin/blob/main/join/NestedLoopJoin.js