For basic methods like .map and .filter, on AsyncIterator, using the SimpleTransformIterator introduces uneccessary overhead via the readAndTransformSimple operator. To improve performance in applications like Comunica it may be worth creating custom iterators with simpler read methods; for instance a synchronous MapIterator could skip buffering entirely and just be implemented as something like
export class MapIterator<T, S> extends AsyncIterator<S> {
...
read() {
if ((item = source.read()) !== null)
return this.map(item);
}
}
@jacoscaz I suspect this is the cause of the potential slowdown you were encountering when doing a large amount of chaining.
For basic methods like
.mapand.filter, onAsyncIterator, using theSimpleTransformIteratorintroduces uneccessary overhead via thereadAndTransformSimpleoperator. To improve performance in applications like Comunica it may be worth creating custom iterators with simpler read methods; for instance a synchronousMapIteratorcould skip buffering entirely and just be implemented as something like@jacoscaz I suspect this is the cause of the potential slowdown you were encountering when doing a large amount of chaining.