overflowdb icon indicating copy to clipboard operation
overflowdb copied to clipboard

Memory optimisation: deduplicate identical `AdjacentNodes.offsets` arrays

Open mpollmeier opened this issue 3 years ago • 0 comments
trafficstars

In large graphs we're wasting ~8% of the heap for duplicate arrays in AdjacentNodes.offsets. That array is only ever mutated in AdjacentNodes.setOffset in a very constraint and straighforward way, so we could easily optimise it.

E.g. we could have a global TIntObjectMap as a cache that maps from the checksum of a given offset array to the array.

mpollmeier avatar Oct 28 '22 08:10 mpollmeier