anton-rs / cannon-rs

An alternative implementation of the OP Stack's Cannon, a MIPS emulator for the EVM.
MIT License
59 stars 10 forks source link

spike: Memory invalidation inefficiencies #23

Open clabby opened 1 year ago

clabby commented 1 year ago

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:

flamegraph