-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Feature/bgp left deep reordering #102
Conversation
Pull Request Test Coverage Report for Build 49
💛 - Coveralls |
// Continue clustering as long as different clusters have common variables | ||
do { | ||
// Find a variable that occurs in more than one subpattern | ||
const allVariables = Array.prototype.concat(...clusters.map((cluster) => cluster.variables)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a nice shorthand, I'll have to remember that :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Totally stole it from stackoverflow somewhere).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only some minor comments.
I'm just wondering what the performance of this is, and how it compares to the current BGP actor. Is it always faster/slower? Or only in some cases? If so, would we be able to create a mediator to choose the best actor in each case?
|
||
public getBoundOperationIterator(op: Algebra.Operation, bindings: Bindings, context?: {[id: string]: any}) | ||
: PromiseProxyIterator<Bindings> { | ||
const getStream = async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? You should be able to put this call directly inside the PromiseProxyIt callback as far as I can see?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This felt a bit more readable to me than putting everything in a single block. But yea, no other reason than that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would combine it then, as this will save us an unnecessary cb+promise.
|
||
const best = { | ||
count: Infinity, | ||
index: -1 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would place the closing bracket on the next line, feels a bit cleaner IMHO :-)
public async runOperation(pattern: Algebra.Bgp, context?: {[id: string]: any}) | ||
: Promise<IActorQueryOperationOutputBindings> { | ||
const clusters = ActorQueryOperationBgpLeftDeepReordering.findConnectedPatterns(pattern.patterns); | ||
// find cluster with least unbound variables (with the least patterns in case of a tie) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your comments after here don't start with a capital letter anymore, I would add them for consistency.
cluster.variables.filter((v) => vars.findIndex((val) => val.equals(v)) < 0)), []) | ||
.map((term) => termToString(term)); | ||
|
||
return { type: 'bindings', bindingsStream, variables }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this actor doesn't provide metadata?
I know it's not required, but it might be good to provide an estimate if possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I didn't do it because it would require calling the metadata from all patterns not the cluster. But now that metadata is in a separate function I will add it. I do wonder how useful this value is going to be for anyone though. :D
Going to rerun the evaluations with this algorithm, but my guess is that it will sometimes be faster and sometimes slower (as the current comparison results with the original TPF client are). But how to determine which one is faster is not really feasible I think. If you can do that you could probably solve a lot of problems for query algorithms :D |
3ec1f5e
to
04c776b
Compare
04c776b
to
7d9d3c6
Compare
@joachimvh Should this be merged as well? Or do you want to evaluate or make some changes first? |
I'm currently re-running the evaluations on a separate server to see if the performance is really that bad compared to the others. I'll see after that. Not sure if it is worth merging if the performance is terrible anyway. |
Reran the tests. For some reason this actor performs well in the beginning but keeps getting worse results the longer the longer the evaluation goes on. Will have to check what's up with that. |
That's strange. Perhaps a stream that doesn't get closed and keeps running for some reason, but I wouldn't know this would occur, everything looks fine to me. |
Yea, will have to look in to how to debug this, apparently I managed to create a memory leak in Comunica I guess :P. It's quite consistent though, did another run on the evaluation and had similar results results, first iteration needs 15s for C1 while the last one needs 50+ |
@joachimvh Should this be included in release 1.0.0 still? |
I would say no, unless I manage to fix the "memory leak" thing by this evening. |
Spent some more time on this. Still no idea what the problem is. :| |
@joachimvh For reference, some changes were made yesterday to the README and package.json templates. Before this is merged, we should update those in this PR as well. (not urgent) |
@joachimvh What should we do with this one? Fix it up so that we can merge it? Or close it? |
Well preferably we should fix it, problem is I don't know what the issue is. :D Should check in if it is magically fixed at this point by all the changes that happened since then. Just closing it seems weird since it should be no problem to do this with Comunica. |
0cc8431
to
abcbd8e
Compare
88cec75
to
ba7bf64
Compare
2a7430b
to
6404c21
Compare
I'm closing this PR due to staleness. The branch still exists should we want to fix it in the future. |
This implements the original TPF query algorithm.
(Performance problem I had was because I executed the promises consecutively).