Improve gas consumption in Solidity

Hi! My name is Sergiu Iacob and I’m a Master’s Student in Computational Optimization (Artifficial Intelligence) in Iasi, Romania.

I’m working on my master’s thesis currently, which focuses on improving gas consumption in Solidity by building and analysing Control Flow Graphs.

I want to make this worthwhile, so could anybody give me some hints as to what specifically could be improved? Any kind of information will be greatly appreciated. I’m currently going through the Solidity documentation, looking at what optimizations the solc compiler does.

I’m thinking on focusing on the YUL IR, since the EVM bytecode might already be optimized fairly well, from what I’m seeing (various tools for this, solc optimization, LLVM optimizer etc). Also, the docs specify the the “new” optimizer works with the YUL.

We already talked on the #solidity-dev channel so I’ll just give a quick answer for anyone who finds this thread later.

I want to make this worthwhile, so could anybody give me some hints as to what specifically could be improved?

We have all current tasks and bugs related to the optimizer tagged with optimizer in the bug tracker. This includes some ideas for new optimizer steps. Not all of these tasks are well fleshed out since that takes time and most of the time they’ll be done by the team anyway but we can always add more details if requested. It’s also always a good idea to come to one of the team calls.

I’m thinking on focusing on the YUL IR, since the EVM bytecode might already be optimized fairly well

Yes, the legacy EVM-based optimizer is pretty limited so we’re focusing on the new Yul optimizer. The new pipeline uses both though. I.e. first the Solidity code is converted to Yul and optimized. Then that’s converted to EVM assembly and optimized at that level.