Gas comparisons of ++ before, after and += 1 Solidity 0.8.10
How are you running this example? It seems wild to me that it costs this much, there definitely is an unnecessary storage write happening somewhere for it to costs more than 23000
Gas price is low. There is no war to fight
Wild - hopefully in 1.0.0 a lot of these compiler oddities will be fixed?
I like writing solidity cause just like me, the output depends on how u ask me 🤠
true but what about the stylistic points gained from using post increment? Might make up for the 6 gas saved 😅
lol lots of rarities with solidity
I wonder why this ‘optimization’ isn’t done regardless of what the programmer writes. The increments yield the same value and don’t rely on any external variables prior to computation, so precomputing this always seems reasonable, doesn’t it?
That's really interesting, even between post increment operator and +=1 there's a gas difference!😯
I must be living through one hell of a lie if these are more efficient.
United States Trends
- 1. #CARTMANCOIN 1,678 posts
- 2. Broncos 65.1K posts
- 3. yeonjun 201K posts
- 4. Raiders 65.5K posts
- 5. Bo Nix 18K posts
- 6. $SMILEY N/A
- 7. Geno 18.4K posts
- 8. Sean Payton 4,726 posts
- 9. daniela 41.6K posts
- 10. #criticalrolespoilers 4,818 posts
- 11. #TNFonPrime 3,996 posts
- 12. Kenny Pickett 1,505 posts
- 13. Bradley Beal 3,450 posts
- 14. Jalen Green 7,317 posts
- 15. Chip Kelly 1,960 posts
- 16. TALK TO YOU OUT NOW 26.3K posts
- 17. Kehlani 9,170 posts
- 18. Pete Carroll 1,936 posts
- 19. Pluribus 6,046 posts
- 20. Jeanty 6,483 posts
Something went wrong.
Something went wrong.