0xPolygonZero / zk_evm

Apache License 2.0
80 stars 35 forks source link

perf: Reduce KERNEL / MemBefore size #669

Closed Nashtare closed 3 days ago

Nashtare commented 3 days ago

More could be done here and there, but this is sufficient to bring all KERNEL variants' lengths down under 65536 with some margin, so that initial MemBefore table of all segment batches is padded to a smaller power of 2.

Mostly revolves around:

Note that we are considering adding some INCR / DECR privileged instruction, which would increase the KERNEL code length safety margin in case of future increase.

Nashtare commented 3 days ago

Had to revert snarkv precompile initialization of calldata, which made it go over the limit again. Will reopen once additional gains are brought in.