Is there a need to remove entries from mapping?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I am adding approximately 3 ~ 5 new entries into the mapping, while the old one will be obsolete after a week.
If the mapping grow larger, is it going to consume more gasses?
Is there a need for me to remove them since they are no longer needed.
solidity gas mapping
add a comment |Â
up vote
1
down vote
favorite
I am adding approximately 3 ~ 5 new entries into the mapping, while the old one will be obsolete after a week.
If the mapping grow larger, is it going to consume more gasses?
Is there a need for me to remove them since they are no longer needed.
solidity gas mapping
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am adding approximately 3 ~ 5 new entries into the mapping, while the old one will be obsolete after a week.
If the mapping grow larger, is it going to consume more gasses?
Is there a need for me to remove them since they are no longer needed.
solidity gas mapping
I am adding approximately 3 ~ 5 new entries into the mapping, while the old one will be obsolete after a week.
If the mapping grow larger, is it going to consume more gasses?
Is there a need for me to remove them since they are no longer needed.
solidity gas mapping
asked Aug 19 at 6:27
s k
2119
2119
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
You pass gas to store the value in the first place. There are no future charges for keeping the data there.
That said, you can get a gas refund for deleting the existing data. That can only offset gas used for a new transaction. So if you can manage to delete the old ones while adding the new ones in the same transaction, you'll save gas (and thus ether) by doing so.
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
That's correct.
â smarx
Aug 19 at 15:18
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
You pass gas to store the value in the first place. There are no future charges for keeping the data there.
That said, you can get a gas refund for deleting the existing data. That can only offset gas used for a new transaction. So if you can manage to delete the old ones while adding the new ones in the same transaction, you'll save gas (and thus ether) by doing so.
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
That's correct.
â smarx
Aug 19 at 15:18
add a comment |Â
up vote
3
down vote
You pass gas to store the value in the first place. There are no future charges for keeping the data there.
That said, you can get a gas refund for deleting the existing data. That can only offset gas used for a new transaction. So if you can manage to delete the old ones while adding the new ones in the same transaction, you'll save gas (and thus ether) by doing so.
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
That's correct.
â smarx
Aug 19 at 15:18
add a comment |Â
up vote
3
down vote
up vote
3
down vote
You pass gas to store the value in the first place. There are no future charges for keeping the data there.
That said, you can get a gas refund for deleting the existing data. That can only offset gas used for a new transaction. So if you can manage to delete the old ones while adding the new ones in the same transaction, you'll save gas (and thus ether) by doing so.
You pass gas to store the value in the first place. There are no future charges for keeping the data there.
That said, you can get a gas refund for deleting the existing data. That can only offset gas used for a new transaction. So if you can manage to delete the old ones while adding the new ones in the same transaction, you'll save gas (and thus ether) by doing so.
answered Aug 19 at 6:30
smarx
15.8k1515
15.8k1515
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
That's correct.
â smarx
Aug 19 at 15:18
add a comment |Â
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
That's correct.
â smarx
Aug 19 at 15:18
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
smarx, thanks for the answer. So adding an entry into a mapping (regardless if it has 0 or 1000000 entries) will always consume the same amount of gas right?
â s k
Aug 19 at 14:05
That's correct.
â smarx
Aug 19 at 15:18
That's correct.
â smarx
Aug 19 at 15:18
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f56853%2fis-there-a-need-to-remove-entries-from-mapping%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password