antoniogarrote / rdfstore-js

JS RDF store with SPARQL support
MIT License
564 stars 109 forks source link

Tweak denormalizeBindingsList performance #146

Open datokrat opened 7 years ago

datokrat commented 7 years ago

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.

antoniogarrote commented 7 years ago

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 commented 7 years ago

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.