This was required when we worked with a team that managed taxonomies with 5M+ nodes. Allocating those arrays (could be 20MB+) over and over for every search was expensive, and I think that it's expensive with today's JVMs too.
I prefer that we keep these somewhere, and would like to propose the following:
- Don't make the allocators so visible on the API. I.e. today StandardFacetsAccumulator takes them in the constructor. Perhaps we can move it to a protected method?
- Then, only extensions would be exposed to it, and whoever extends SFA, or writes his own Accumulator, IMO should be allowed to reuse arrays.
- By default, don't cache arrays. Today by default we reuse one array, and I think that for the common case, this is not needed.
So I do like to keep the option for extensions to reuse arrays, just because we've seen that it's needed in some cases. But I am +1 for 'hiding' that option somewhere, so that only experts that need it, will find it .