SitePen / dstore

A data infrastructure framework, providing the tools for modelling and interacting with data collections and objects.
http://dstorejs.io/
Other
281 stars 83 forks source link

Improve putSync performance of Memory store. #226

Closed nijuyr closed 4 years ago

nijuyr commented 4 years ago

Closes #183

This PR improves the performance of putSync by

  1. skipping splice operation on array when the index of the updated object is not changed. (most of simple object update via putSync does not change index)
    • Array.prototype.splice is an expensive operation especially when the size of the array is huge.
  2. skipping re-indexing when the index of the updated object is not changed.

Performance - Updating 10000 objects with putSync takes ~15ms

dylans commented 4 years ago

Thanks @nijuyr , we will review this in early January and hopefully land this and then get a new dstore release live that includes this update.

msssk commented 4 years ago

This enhancement was made in #227. Thank you for your work on this @nijuyr!