I've been hitting a performance issue that I'm not sure how to fix exactly. I have a lot of large read-only documents that I'm mapping out as objects with id<CBLJSONEncoding>. Usually, I use queries and get the row.document, and then make my CBLModels, and then access the models properties, which are heavily nested CBLJSONEncoding classes. The creation of these models is expensive as I've found through my debugging, and they are constantly being destroyed since I'm using getters only for local information.
From what I've seen in the source for Couchbase, it seems that CBLDocument only stores a weak pointer to the CBLModel, and only CBLModels which are changed and set the needsSave flag are prevented from being dealloc'd as they are added to an unsavedMutableSet.
I was wondering if there might be any bad side-effects if I were to create an NSCache for my read-only CBLModels?
In particular, I'm still not sure how CBLDocuments are deallocated and whether this would impact my pre-existing CBLModels. I see that the documents are added to a CBLCache, but how are they checked to see if a models that wraps around them have the unsaved properties when the cache wants to clear them? I looked around for calls to document.modelObject, but didn't find much.
Any insights into this would be greatly appreciated.
Cheers,
Ragu