4 Comments
Jul 26, 2022Liked by Nick Mudge πŸ’Ž

If you hit a stack limit then a trick I use is to create a local array with constant offsets to the variable you need. That way the compiler only sees 1 variable (the array) and the constants rather than the n variables in the array. Constants make the code a bit more readable than literal numbers.

Not sure what the gas cost is of an array lookup which is bound to be higher than just a variable, but if it means that the function can compile its the cost of doing it.

Expand full comment
Jul 8, 2022Liked by Nick Mudge πŸ’Ž

Thank you!

Expand full comment