Thanks for clarifying. I know that I should not recreate the view index that often because its not the performance most tuned operation.
But yet I do need to do this because I have a dynamic query which is nearly impossible get done with only the query api. (I would need to create a lot of views and merge the results) Any advice on how I can speed up execution of the map function on android? For what should I look out? For example I am calling emit a lot for a single document. Am Dienstag, 13. Oktober 2015 17:52:34 UTC+2 schrieb Jens Alfke: > > > On Oct 13, 2015, at 2:48 AM, [email protected] <javascript:> wrote: > > The com.couchbase.lite.Mapper.map function is supposed to be side effect > free. > Does this mean that it might be called by Couch by several Threads? > > > Yes, it *might* be. It isn’t, in the current implementation, but that’s > an optimization that could be made in the future. > > (I did try this experimentally about a year ago, on iOS, but it didn’t > improve performance. On a two-core CPU the overhead of managing the > parallelism cancels out the benefits.) > > The main reason to avoid side effects is that you have no idea when the > map function might run. It’s probably on a background thread, and the > timing and the order of index updates is implementation-dependent. So don’t > use or modify any external state. > > —Jens > > -- 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/ce258a47-5267-402a-8b57-f0b6e2897e6f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
