-
Notifications
You must be signed in to change notification settings - Fork 6
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
performance: Use upstream optimizations #15
Comments
Moreover - I think it should look something like import { AsyncIterator } from 'asynciterator';
export class NestedLoopJoin<D, T> implements AsyncIterator<T> {
private source: AsyncIterator<T>;
constructor(left: AsyncIterator<D>, private right: AsyncIterator<D>, join: (left: D, right: D) => T) {
this.source = union(left.map(leftElem => right.clone().mapFilter(rightElem => join(leftElem, rightElem))));
}
read() {
return this.source.read();
}
close() {
this.source.close();
this.right.close();
}
// Closing still needs to be handled so
}
export class DynamicNestedLoopJoin<D, T> implements AsyncIterator<T> {
constructor(left: AsyncIterator<D>, right: (elem: D) => AsyncIterator<D>, join: (left: D, right: D) => T) {
return union(left.map(leftElem => right(leftElem).mapFilter(rightElem => join(leftElem, rightElem))));
}
} where |
Pinging @joachimvh as well, since he may have some insights on this as well. |
I don't remember much about the code here, but they're simple classes so not that much you can do wrong I think. The code above looks fine at a first glance. Returning from a constructor is interesting though, didn't know you could do that. Would that break an |
In light of upstream changes we should avoid using the
SimpleTransformIterator
here to be able to take full advantage of them@jacoscaz @rubensworks
The text was updated successfully, but these errors were encountered: