Memory in Cannon contains a cache for recently accessed pages, and within those pages a cache for intermediate nodes to reduce the merkleization time. When the page data is invalidated (i.e. it's been changed), the root will need to be recalculated on the next pass.
The program is pretty performant, but merkleization is expensive and takes the most time during each step (w/ proof generation turned on), so it would be great to look into how we can further optimize this codepath to decrease cache misses and redundant recomputation of merkle roots.
Overview
Memory in Cannon contains a cache for recently accessed pages, and within those pages a cache for intermediate nodes to reduce the merkleization time. When the page data is invalidated (i.e. it's been changed), the root will need to be recalculated on the next pass.
The program is pretty performant, but merkleization is expensive and takes the most time during each step (w/ proof generation turned on), so it would be great to look into how we can further optimize this codepath to decrease cache misses and redundant recomputation of merkle roots.
Refs:
fill_subtree_cache
andmerkleize_subtree
inpage.rs