Skip to content
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 optimizations by 0xth0mas #1

Merged
merged 3 commits into from
Aug 10, 2023
Merged

Conversation

hoanhan101
Copy link
Member

No description provided.

·-------------------------------|---------------------------|--------------|-----------------------------·
|     Solc version: 0.8.17      ·  Optimizer enabled: true  ·  Runs: 1337  ·  Block limit: 60000000 gas  │
································|···························|··············|······························
|  Methods                                                                                               │
··············|·················|·············|·············|··············|···············|··············
|  Contract   ·  Method         ·  Min        ·  Max        ·  Avg         ·  # calls      ·  usd (avg)  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  addTraits      ·     616427  ·    1009434  ·      774554  ·            6  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  ownerMint      ·          -  ·          -  ·     5451959  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  setMintStatus  ·          -  ·          -  ·       26760  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  Deployments                  ·                                          ·  % of limit   ·             │
································|·············|·············|··············|···············|··············
|  LeetBrian                    ·          -  ·          -  ·     3108518  ·        5.2 %  ·          -  │
·-------------------------------|-------------|-------------|--------------|---------------|-------------·

initial optimizations, packing 4 tokens of traits

·-------------------------------|---------------------------|--------------|-----------------------------·
|     Solc version: 0.8.20      ·  Optimizer enabled: true  ·  Runs: 1337  ·  Block limit: 60000000 gas  │
································|···························|··············|······························
|  Methods                                                                                               │
··············|·················|·············|·············|··············|···············|··············
|  Contract   ·  Method         ·  Min        ·  Max        ·  Avg         ·  # calls      ·  usd (avg)  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  addTraits      ·     618698  ·    1011485  ·      776749  ·            6  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  ownerMint      ·          -  ·          -  ·     1391340  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  setMintStatus  ·          -  ·          -  ·       26730  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  Deployments                  ·                                          ·  % of limit   ·             │
································|·············|·············|··············|···············|··············
|  LeetBrian                    ·          -  ·          -  ·     3140961  ·        5.2 %  ·          -  │
·-------------------------------|-------------|-------------|--------------|---------------|-------------·

trying |=

·-------------------------------|---------------------------|--------------|-----------------------------·
|     Solc version: 0.8.20      ·  Optimizer enabled: true  ·  Runs: 1337  ·  Block limit: 60000000 gas  │
································|···························|··············|······························
|  Methods                                                                                               │
··············|·················|·············|·············|··············|···············|··············
|  Contract   ·  Method         ·  Min        ·  Max        ·  Avg         ·  # calls      ·  usd (avg)  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  addTraits      ·     618698  ·    1011485  ·      776749  ·            6  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  ownerMint      ·          -  ·          -  ·     1393816  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  setMintStatus  ·          -  ·          -  ·       26730  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  Deployments                  ·                                          ·  % of limit   ·             │
································|·············|·············|··············|···············|··············
|  LeetBrian                    ·          -  ·          -  ·     3143567  ·        5.2 %  ·          -  │
·-------------------------------|-------------|-------------|--------------|---------------|-------------·

cache calldata arrays, requires adding ("memory-safe") to all assembly blocks in sstore2/erc721a

·-------------------------------|---------------------------|--------------|-----------------------------·
|     Solc version: 0.8.20      ·  Optimizer enabled: true  ·  Runs: 1337  ·  Block limit: 60000000 gas  │
································|···························|··············|······························
|  Methods                                                                                               │
··············|·················|·············|·············|··············|···············|··············
|  Contract   ·  Method         ·  Min        ·  Max        ·  Avg         ·  # calls      ·  usd (avg)  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  addTraits      ·     617098  ·    1009907  ·      775160  ·            6  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  ownerMint      ·          -  ·          -  ·     1343733  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  LeetBrian  ·  setMintStatus  ·          -  ·          -  ·       26726  ·            1  ·          -  │
··············|·················|·············|·············|··············|···············|··············
|  Deployments                  ·                                          ·  % of limit   ·             │
································|·············|·············|··············|···············|··············
|  LeetBrian                    ·          -  ·          -  ·     3142941  ·        5.2 %  ·          -  │
·-------------------------------|-------------|-------------|--------------|---------------|-------------·
@hoanhan101 hoanhan101 merged commit 7a66600 into master Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants