Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

datokrat
Copy link
Contributor

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.

});
};
if (lazyCache['#'+oid]) {
process.nextTick(function() { cb(lazyCache['#'+oid]) });
Copy link
Owner

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!

Copy link
Contributor Author

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).

Copy link
Contributor Author

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.

@antoniogarrote
Copy link
Owner

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.

@datokrat
Copy link
Contributor Author

datokrat commented Dec 9, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants