-
Notifications
You must be signed in to change notification settings - Fork 109
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
Tweak denormalizeBindingsList performance #146
base: master
Are you sure you want to change the base?
Tweak denormalizeBindingsList performance #146
Conversation
using lexicon cache
}); | ||
}; | ||
if (lazyCache['#'+oid]) { | ||
process.nextTick(function() { cb(lazyCache['#'+oid]) }); |
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.
Can you use the nextTick
function in src/utils.js
instead of process.nextTick
?
Thanks!
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.
Okay, I'll change it. And add the same improvement at a similar place (three times better performance in my tests).
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.
Okay, using the utils function makes performance drop extremely. Why exactly did you implement it using setTimeout? It's a lot more inefficient, significant enough to make it unusable for my use case.
Thanks for the improvement. I have some basic benchmarking tests in the lubm/browser directory. I will try to run them before merging the PR. |
Why do you use setTimeout(..., 0) instead of process.nextTick()? I just noticed that this tremendously slows down the engine. It literally reverses the performance improvement. |
The query engine often redundantly fetches same objects from the lexicon in denormalizeBindings(List). Using a lazy cache for the already fetched items reduces the request time significantly; an exemplar query took only 1.5 seconds instead of 10 without the tweak.