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