-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gas optimization by implementing unchecked index increment #13
Add gas optimization by implementing unchecked index increment #13
Conversation
LGTM after rebase |
…ion-unchecked-increment-in-loop
…ing chipAddressesOldLength to replace chipAddressesOld.length
Have first merged with the updated main branch, updated the gas-snapshot, and combined unchecked logic with the change of for loop with do while loop after seeing @Arkay92 's PR as the PR seems did not pass the test. Here is the gas snapshot comparison by running testApprove() (gas: 0 (0.000%)) |
Gas comparison with v0.2.0 testApprove() (gas: 0 (0.000%)) |
Here is the comparison of the updated and the original gas snapshot for the test of PBTSimple.sol
PBTSimpleTest:testGetTokenDataForChipSignature() (gas: 127965 → 127811) -154
PBTSimpleTest:testGetTokenDataForChipSignatureBlockNumTooOld() (gas: 122516 → 122357) -159
PBTSimpleTest:testGetTokenDataForChipSignatureInvalid() (gas: 131807 → 131653) -154
PBTSimpleTest:testGetTokenDataForChipSignatureInvalidBlockNumber() (gas: 122355 → 122191) -164
PBTSimpleTest:testIsChipSignatureForToken() (gas: 216733 → 216594) -139
PBTSimpleTest:testMintTokenWithChip() (gas: 176613 → 1776454) -159
PBTSimpleTest:testSeedChipToTokenMapping() (gas: 115251 → 115137) -114
PBTSimpleTest:testSeedChipToTokenMappingExistingToken() (gas: 212298 → 212184) -114
PBTSimpleTest:testSeedChipToTokenMappingInvalidInput() (gas: 17175) ±0
PBTSimpleTest:testSupportsInterface() (gas: 7059) ±0
PBTSimpleTest:testTokenIdFor() (gas: 117085 → 117028) -57
PBTSimpleTest:testTokenIdMappedFor() (gas: 66779 → 66722) -57
PBTSimpleTest:testTransferTokenWithChip(bool) (runs: 256, μ: 211915 → 211757, ~: 211834 → 211675) (±0, -158, -159)
PBTSimpleTest:testUpdateChips() (gas: 171055 → 170868) -187
PBTSimpleTest:testUpdateChipsInvalidInput() (gas: 16433) ±0
PBTSimpleTest:testUpdateChipsUnsetChip() (gas: 23430) ±0