Hi Vinary, Thank you very much for your updated report.
The performance of View.updateIndex() on PhoneGap Android has two bottle-necks. One is Native JSON Collator for SQLite (https://github.com/couchbase/couchbase-lite-android/tree/master/src/main/jni/JsonCollator) andMap/Reduce JavaScript engine for Java (https://github.com/couchbase/couchbase-lite-java-javascript). - JSON Collator: By addressing the ticket (https://github.com/couchbase/couchbase-lite-java-core/issues/502), JSON collator became fast if JSON is only contains ASCII characters. I believe your first simple test contained only ASCII ranged characters in JSON data. And your test result was good enough. However, I believe your second real test contains non-ascii characters (International characters) in JSON data. And I assume that performance was not good enough because of this. To solve this issue, we need to write native unicode collator. We already filed ticket for this (https://github.com/couchbase/couchbase-lite-java-core/issues/504). - couchbase-lite-java-javascript: Currently we don't have good performance test tool for JavaScript engine. First we should write performance test, and measure the performance. Then we could try to improve the performance. > Todo Lite Source code link > https://www.dropbox.com/s/xmiip8fbugh6682/ToDoLite%20%28copy%29.tar.gz?dl=0 Thank you for source code. I will check performance here. And I filed the ticket for PhoneGap View.updateIndex() performance issue on our github repo. https://github.com/couchbase/couchbase-lite-java-core/issues/630 Thanks, Hideki On Saturday, May 16, 2015 at 5:49:41 AM UTC-7, Vinay Bhinde wrote: > > Hello Hideki, > > > Few days back you had given me a updated build of cblite phonegap plugin > which improved the view performance for android. I reported that it took > around 7 seconds initially to index about 150 docs but then it dropped to > milliseconds. > > Seems like i judged it very early and with only a particular type of docs. > I changed my document and added a few more fields to make it little big. I > added around 100 docs on a click of button to cblite and then performed a > view query. It took around *2.2 - 2.5 seconds *for android to index that > view first and then return the data. This time interval is very long for > the users of my application. Every time i add 100 docs and then query the > view, it takes about that much time to return the data. > > Now my application involves modules wherein i need to call 2-3 different > views after adding about 12 or more docs. Now it takes 400 ms for android > to index the view after adding 10 docs (the view which i am talking about > here is a simple view with just a emit, no reduce or heavy emit's. If view > has a reduce function or some complex emit structure then the above times > mentioned are even more higher). So when all my view are called one after > another the time adds up and it takes about 5 seconds for my views with > reduce function to return data from cblite. > > Also there are many other screens which involve calling multiple views and > whenever and significant change is made to db, the first query thereafter > to all these views take time and when u add up the time it is in seconds. > > Speaking from a user perspective i cannot make the user wait for those > many seconds every time they create new records and hence the app becomes > unusable on android. > > Same app on ios indexes views in milliseconds. Even for 100 docs inserted > , a view query takes anywhere between 150 ~ 200 milliseconds to index and > return data. 2200 ms and 200ms. Thats a difference of 2000 ms between ios > and android. You can check the same in your todo lite phonegap app which i > have modified to show my stats. I am attaching the source code dropbox > folder link here. You can download the app and run tests on it. > > I know the performance you get on iOS will not be matched on android due > to fundamental differences but what i need to find out that is there any > way possible to make performance on android relatively close to iOS if not > match it. Can we do something to bring the view indexing time down. Are we > doing anything fundamentally wrong while working with cblite ? maybe you > can look at the ToDoLite code and help us out somewhere. > > I am letting my environment know under which i got the view indexing times > > *FOR ANDROID* > *Device - Moto G 1.2 Ghz quad core running android 5.0.2* > *Ram - 1 gb* > *view index time for 100 docs - around 2.2 secs* > > *view index time for 10 docs - around 400 ms* > > *FOR IOS* > *Device - Iphone 5s with ios 7* > *view index time for 100 docs - around 150ms* > *view index time for 10 docs - around 20 ms* > > The cblite plugin used for above test was taken from the below link which > u gave earlier. > > > http://cbfs-ext.hq.couchbase.com/builds/Couchbase-Lite-PhoneGap-Plugin_1.0.4-47-63.zip > > <http://www.google.com/url?q=http%3A%2F%2Fcbfs-ext.hq.couchbase.com%2Fbuilds%2FCouchbase-Lite-PhoneGap-Plugin_1.0.4-47-63.zip&sa=D&sntz=1&usg=AFQjCNF-rbZvHyiNZzjdd84jSoG2LQaozw> > > Todo Lite Source code link > > https://www.dropbox.com/s/xmiip8fbugh6682/ToDoLite%20%28copy%29.tar.gz?dl=0 > > Awaiting your feedback ! > Thanks ! > > > > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/366d5365-3d7b-4c1a-b6c7-3d7541a228af%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
