Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    In case of msg.sender, reading from memory consumes 3 gas (mload opcode) and getting the address of the sender consumes 2 gas (caller opcode). Essentially, saving the variable in memory and reading it afterwards is more expensive than using msg.sender every time. Commented Dec 19, 2024 at 11:35
  • In his case he's not using mload but reading from the stack. So it's all about stack manipulation (DUP, POP, etc..) Commented Dec 19, 2024 at 13:58