Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Performance issue querying a view. #4

Closed
enricogior opened this issue Dec 1, 2016 · 6 comments
Closed

Performance issue querying a view. #4

enricogior opened this issue Dec 1, 2016 · 6 comments
Assignees
Labels

Comments

@enricogior
Copy link
Member

enricogior commented Dec 1, 2016

@czyzm reported the issue:

There are 4 tests:
1.      PouchDB used in node on desktop (https://github.com/czyzm/TestViewsNode).
2.      PouchDB used in jxcore on desktop (https://github.com/czyzm/TestViewsJx).
3.      PouchDB used in WebView on mobile (https://github.com/czyzm/TestViewsMobile).
4.      PouchDB used in jxcore on mobile (https://github.com/czyzm/TestViewsMobile).
 
All tests have the same scenario:
-          Create DB
-          Insert 2000 documents into DB
-          Insert design doc (view) into DB
-          Run the query and calculate the time of its execution 
           (the first query launches view build)
 
Here are the results:
Test                 Query exec time (2000 docs) Query exec time (500 docs)
1. Node (desktop)    2.5s                        0.5s
2. Jxcore (desktop)  3s                          0.5s
3. WebView (S7)      11s                         3s
4. Jxcore (S7)       90s                         21s
 

https://github.com/czyzm/TestViewsMobile
https://github.com/czyzm/TestViewsNode
https://github.com/czyzm/TestViewsJx

@enricogior
Copy link
Member Author

The execution time is linear with the number of documents inserted in the DB:

Docs #    Exec time
 100       4s
 500      19s
1000      43s
2000      85s

@enricogior
Copy link
Member Author

Insert execution time doesn't show performance issues, on the contrary, in the WebView it takes 29s while using JXcore only 13s.

@yaronyg
Copy link
Member

yaronyg commented Dec 1, 2016

@enricogior The question going through my head is - is this a failure in PouchDB or Leveldown-Mobile? The evidence argues against PouchDB (since the Webview perf is reasonable and the same code should be used in both places) but a quick way to check is to switch the test from using leveldown to using the in memory adapter.

See https://pouchdb.com/adapters.html#pouchdb_in_node_js for details but all you should have to do is run 'npm install memdown' in the project and then replace https://github.com/czyzm/TestViewsMobile/blob/211771e1edca9d4db49099135114b20a884e5b29/www/jxcore/app.js#L41 with 'db: require('memdown'),' and then re-run the test.

If you see the same bad perf then it's a PouchDB bug and you should bounce it back to me. If you see reasonable perf then that is pretty good evidence that something is wrong with leveldown-mobile.

@enricogior
Copy link
Member Author

These are the test results using MemDown instead of LevelDown-Mobile:

Docs #    Exec time
 100       6s
 500      25s
1000      53s
2000      114s

@enricogior enricogior assigned yaronyg and unassigned enricogior Dec 6, 2016
@enricogior
Copy link
Member Author

@yaronyg we can close this issue in the leveldown-mobile repo and open a new one specific for PouchDB.

@yaronyg yaronyg assigned enricogior and unassigned yaronyg Dec 6, 2016
@yaronyg
Copy link
Member

yaronyg commented Dec 6, 2016

Please test with spidermonkey with JIT on desktop just to see what our perf looks like. Also we should try memdown on desktop with normal node and normal jxcore (v8).

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

No branches or pull requests

2 participants