-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Can you share the code you use to generate the chart? |
Beta Was this translation helpful? Give feedback.
-
I found out what it was, we have two things. The first thing is about space allocation, in Ethereum the allocation is by block and a block fits 32 booleans, so when I'm going to allocate an element that takes a position 32n+1(33,65,97,...) Ethereum need to add new block costing more gas than normal (this explains the large peaks on the graph). The second thing is about the lower dense part of the graph. The reason it happens is because saving a false is cheaper than true. |
Beta Was this translation helpful? Give feedback.
I found out what it was, we have two things.
The first thing is about space allocation, in Ethereum the allocation is by block and a block fits 32 booleans, so when I'm going to allocate an element that takes a position 32n+1(33,65,97,...) Ethereum need to add new block costing more gas than normal (this explains the large peaks on the graph).
The second thing is about the lower dense part of the graph. The reason it happens is because saving a false is cheaper than true.
To explore the behavior I tested it with integers. I've found that saving 0 is cheaper than a positive number and saving a positive number is cheaper than saving a negative.