MDSLKTR / pouch-vue

Pouchdb bindings for Vue.js
MIT License
90 stars 17 forks source link

Remove pouchdb-live-find #41

Open assemblethis opened 4 years ago

assemblethis commented 4 years ago

I've been comparing the use of pouchdb-live-find vs pouchdb-find to update the selector results when a new event is emitted by the changes feed.

When you get to larger pouch databases I find that just calling pouchdb-find vs using pouchdb-live-find is faster.

These tests were just comparing the 'ADD' action when a new doc comes in on the changes feed, not the 'UPDATE' action or 'DELETE' action. RegularFind is if the pouchdb is queried using a new find request and LiveFind is the sophisticated array manipulation of the old find request to include the new doc that pouchdb-live-find does.

Rough and preliminary results using Chrome 75:

<100 docs: RegularFind: 0.1591796875ms LiveFind: 0.0888671875ms

100 < docs < 300:

RegularFind: 0.176025390625ms LiveFind: 0.17919921875ms

300 < docs < 600:

RegularFind: 0.382080078125ms LiveFind: 1.2099609375ms

600 < docs < 1000:

RegularFind: 0.18408203125ms LiveFind: 1.072021484375ms

1000 < docs:

RegularFind: 0.405029296875ms LiveFind: 1.22705078125ms

I'll look into this a little closer and come up with a PR that removes the dependency on pouchdb-live-find and includes the logic to just do a new find query when new data comes in on the changes feed.

assemblethis commented 4 years ago

My previous comparison between RegularFind and LiveFind doesn't hold up now that I've taken a second look at it. I was not waiting for the promise to resolve for the time calculation for RegularFind so the above results are incorrect.

A second look makes LiveFind look very performant compared to RegularFind. I'll continue to look closer at the results and update this issue when I next have a chance.

I'm trying to establish how useful LiveFind is and what it contributes to the pouch-vue plugin.