In the Hamt class, load and create of the IPLD hashmap take almost all of the time.
This process can be optimized and shared between Hamt instances since the hashmap is an immutable object, so it should not need to be loaded and created each time crush is called.
Calculating diff blocks might be able to be done more directly in the same way as compare reads the raw blocks, rather than relying on tracking the puts in the putStore.
Or the putStore could have a tracking flag that gets turned on, so that it reports back what was added in, then uses a form of trim to weed out blocks it already had.
Given that there are several HAMTs in every chain, all of which get crushed often, this could speed up crushing significantly.
In the Hamt class, load and create of the IPLD hashmap take almost all of the time. This process can be optimized and shared between Hamt instances since the hashmap is an immutable object, so it should not need to be loaded and created each time crush is called.
Calculating diff blocks might be able to be done more directly in the same way as compare reads the raw blocks, rather than relying on tracking the puts in the putStore.
Or the putStore could have a tracking flag that gets turned on, so that it reports back what was added in, then uses a form of trim to weed out blocks it already had.
Given that there are several HAMTs in every chain, all of which get crushed often, this could speed up crushing significantly.