Consider pooling of table classes (and more?)
hassila opened this issue · comments
Makes me wonder if somehow pooling all Table classes and Lazy accessors is a good idea
I think replicating the create/reset/reuse (recycle?) for a small (preferably tunable "none/small/medium/large") number of instances could be extremely beneficial and worth trying out. For streaming applications with very repeatable data flows it could give a very significant boost.
The big issue is when to actually recycle instances - I wrote up a small generic pool and this turned out to be non-obvious when to recycle them. For Builder where we have tight control on usage and lifespan it is easier... Essentially we would want to put them there in deinit {}, but that is too late...
I thought about using retainCount
but it might be also not a good idea.
Did a first take in #43 - isUniquelyReferencedNonObjC() came handy.
One big note - the current instance pooling is inherently not thread safe, should address it before closing this one.
See #44, closing this one and following up there.