Hey everyone, brief update regarding code sizes on compiled Solidity.
While pallet-revive supports contracts of up to 1mb in size, smaller contract code blobs get less startup and proof size overhead, which directly translates into more transaction throughput. Like on the Rust side, we worked on bringing Solidity contract sizes down as well: We just released resolc v1.3.0. This version ships the newyork (NEW Yul OptimizeR Kit), an IR in between Yul and LLVM. Thanks to the newyork optimizer, we observe code size improvements typically between -20% up to -50% vs. resolc without --newyork.
As the result we can demonstrate: Business logic can be expressed in Solidity and JITed via PVM, while deployed contracts have about the same size (or can be even smaller) as well optimized Rust versions of the same business logic. Below chart shows a comparison of various popular ERC implementations in different languages or with different compilers (the pattern is quite consistent, I just took the ones from @smiasojed that aren’t synthetic benchmarks):
Notes:
- Contracts taken from here.
- Stylus is a forked version of the Stylus SDK that can compile to PVM.
- I applied a small code change to
revmcsuch that it targets RISC-V with-Oz, to match the target machine and optimization settings with resolc. The result isn’t a fully functional PVM blob but an .ELF object, but this gives us some hints into how bytecode recompilation would perform nonetheless. - EVM still being a lot smaller in code size is expected and a structural trade-off for runtime performance gains via PVM JIT.
