Improved interface of BaseSink to lower memory usage
It has been reported that the method sortedEntitiesAsJSON was using a lot of memory
as it was converting all entities to JSON in one go (keep in mind that an entity can
be a huge histogram and that there may be a lot of them).
It has thus been replaced by method applyToAllSortedEntities
which applies a lambda
to all entities but respecting the order that was there in sortedEntitiesAsJSON.
At any given moment, only one entity is converted to JSON in memory, improving
a lot memory usage.
Fixes #279 (closed)