Is there a cut-off where a variable name uses more memory? For instance:
uint public priceOfEthYesterday9AMUSAET
vs
uint public pEth
One is more descriptive, but if it's costing me gas I don't want to do this.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityIs there a cut-off where a variable name uses more memory? For instance:
uint public priceOfEthYesterday9AMUSAET
vs
uint public pEth
One is more descriptive, but if it's costing me gas I don't want to do this.
The name of a variable does not affect gas usage.
In this case, you are using a uint
, so the gas for this variable is already defined by that size. All STORE
s performed on this will behave the same no matter the length of the variable name.
The length of a variable name has absolutely 0 effect on gas, and therefore transaction fee.
The length of a function name also has no effect on the transaction fee, because a 4 byte hash of the function name and its parameter types is used to select the correct function to execute, instead of the full function name.