Saving 2676 Gas with YUL Optimization

Saving 2676 Gas with YUL Optimization

Let's say you have a function in your smart contract that computes the sum of an array and you want to optimize it

This is the first form of the function

1st Optimization: You mark the += operation as unchecked


2nd Optimization: You cache the result and you put it in storage after

3rd Optimization: You cache both the result and the length of the array

4th Optimization: You handle calldata using YUL


要查看或添加评论,请登录

Paul Socarde的更多文章

社区洞察

其他会员也浏览了