Solidity Gas Optimization in Interviews: Why Juniors Fail the Question and What Seniors Actually Look For
I realized recently that I’ve been approaching “gas optimization” totally wrong in interviews. Every time the question comes up, I start dumping the usual lines — avoid storage writes, use calldata, short-circuit conditions, pack variables. It feels safe because everyone repeats these same things.
But last week, a senior engineer stopped me mid-answer and said:
“Okay, but how do you decide when to optimize?”
And I didn’t know what to say. I froze. It suddenly hit me that I’ve been memorizing patterns instead of understanding how seniors think about gas in an actual production repo.
My personal projects aren’t large enough to give me a real sense of “hot paths,” and I haven’t worked on a contract where a single SSTORE could cost thousands in aggregate. So I’m confused about what interviewers actually want — do they expect juniors to talk about profiling? Trade-offs? CEI consistency? Auditability? Or just awareness of common pitfalls?
How do you answer gas-optimization questions in a way that sounds like real engineering judgment instead of parroting a checklist?