Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Gas is a 'sub-currency' which enables the EVM and Ethereum's decentralised computer to run -- with each operation, an amount of gas (proportional to the computational effort required to perform the operation) is consumed.
0
votes
Gas optimization for my smart contract?
The first answer is great, I'm writing this for others.
As you have created getter functions for every storage variable. Then you should use private instead of public.
address private user;
ad …
2
votes
Is there a gas fee when storing the mapping type of key?
Yes, it costs gas. Mappings are stored on the storage level. When you initialize a mapping, the key and value are set to default (in this case 0 & 0x0). …
17
votes
1
answer
8k
views
Why does ++i cost less gas than i++?
388824 gas
// transaction cost 338107 gas
// execution cost 338107 gas
// foobar.find() execution cost 36221 gas
And when I run the same function using ++i, this is what the cost is:
// ++i
// gas … 388327 gas
// transaction cost 337675 gas
// execution cost 337675 gas
// foobar.find() execution cost 36201 gas
Clearly, i++ costs more gas than ++i, But Why? …