Closed olintononthemovesw closed 4 years ago
This data can be found by opening the developer tools (we used google chrome) and selecting the Performance tab. Start recording, then execute some data retrieval using JsStore (the more complicated the better), and stop recording once the result has arrived.
A solution to this would be to implement the Promise() framework rather than the one for Task(). Difference described here: https://glebbahmutov.com/blog/difference-between-promise-and-task/
As I understand it, running functions as a Task creates a new global execution context.
Just like a Task, a Promise can be chained together, with execution dependants and callbacks. The main difference is that a when a Promise system is used, the global execution context is maintained and only the functional execution context is created/destroyed.
We dont use Task api but promise only. Not sure how you are getting task :thinking:
I will look into the performance thing & will share the screenshot here
BTW - you can use our idbstudio app for performance testing and share the results publically. Here is the link - https://ujjwalguptaofficial.github.io/idbstudio/
Thanks
Tasks are automatically setup when a new global execution context is made. The performance degredation is more easily seen when there are 1000+ records in the tables.
What "global execution context" ? Could you point me to some article ?
I am sorry but i am not able to understand what you are saying. As for what you have suggested - we are already using promise api.
Thanks
this explains it nicely: https://www.valentinog.com/blog/context/ or this: https://hackernoon.com/execution-context-in-javascript-319dd72e8e2c
essentially, all of the code needs to be kept inside a single 'global' function, while everything else is kept 'in memory' (or added as a dependancy at the very biginning of the global function call)
@olintononthemovesw since JsStore is a library its already inside a global function, you cant access JsStore code outside JsStore without calling JsStore.
Looks like this problem is actually caused by the base IndexedDb implementation of their Cursor...
Thank you for being an active repository!
Tasks Overhead
We have been running performance testing on our JsStore queries recently. We've notices that there is quite a significant overhead wasted on creating and destroying Tasks.
You can see that the actual function call time is reasonably small. Generally it is not a good practice creating an entire Task/Threat for a single functional operation.
I like that JsStore implements Tasks. However, for performance reasons, function calls should be grouped together into a single Task (rather than a Task per function).
Regards,
Osian