On Oct 13, 2015, at 2:48 AM, [email protected]<mailto:[email protected]> 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/E2095BCF-0777-4EA6-A5C2-ADDDCE2F97B7%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
