nibbstack / erc721

The reference implementation of the ERC-721 non-fungible token standard.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Publish gas performance metrics

fulldecent opened this issue · comments

For example, today I need to know what minting costs for each NFT flavor. But this is something we should publish in more detail.

Would love to use this information to feature "ERC-721 v2"

Yup, soon :).

Hey @dafky2000 please share if you have any ideas on how we can best format and present this information.

I'm specifically interested in the differences between "v1" and "v2" so, some comparison tables would be useful in my case.

Plain

ERC-721 ERC-721 v2
transfer 94955 gas 54825 gas (-42%)
transferFrom 94955 gas 58655 gas (-39%)
mint 94955 gas 35554 gas (-63%)
balanceOf 94955 gas 32468 gas (-76%)
ownerOf 94955 gas 94955 gas (+-0%)

Enumerable

ERC-721 ERC-721 v2
transfer 94955 gas 54825 gas (-42%)
transferFrom 94955 gas 58655 gas (-39%)
mint 94955 gas 35554 gas (-63%)
balanceOf 94955 gas 32468 gas (-76%)
ownerOf 94955 gas 94955 gas (+-0%)

Meta data

ERC-721 ERC-721 v2
transfer 94955 gas 54825 gas (-42%)
transferFrom 94955 gas 58655 gas (-39%)
mint 94955 gas 35554 gas (-63%)
balanceOf 94955 gas 32468 gas (-76%)
ownerOf 94955 gas 94955 gas (+-0%)

This are preliminary results. Solidity version has an impact on results. In a future version we will automise the test but currently they where done trough remix and on ropsten. V2 rc1 is the baseline. This is a summary of the average of results. For more details about the test check the spreadsheet here.

Plain

0xcert v2 RC1 0xcert v1 OpenZeppelin 0xcert Framework monolith
mint 59472 gas 59461 gas (-0.02%) 59042 gas (-0.73%) 59207 gas (-0.45%)
approve 46616 gas 46579 gas (-0.08%) 46111 gas (-1.1%) 45917 gas (-1.52%)
safeTransferFrom 37336 gas 37924 gas (+1.55%) 37336 gas (-2.35%) 35891 gas (-4.03%)

Enumerable

0xcert v2 RC1 0xcert v1 OpenZeppelin 0xcert Framework monolith
mint 133673 gas 146788 gas (+8.93%) 149097 gas (+10.34%) 133271 gas (-0.3%)
approve 46616 gas 46579 gas (-0.08%) 46111 gas (-1.1%) 45917 gas (-1.52%)
safeTransferFrom 59070 gas 69467 gas (+14.93%) 66847 gas (+11.63%) 57458 gas (-2.81%)

Metadata

0xcert v2 RC1 0xcert v1 OpenZeppelin 0xcert Framework monolith
mint 82559 gas 82381 gas (-0.22%) 82177 gas (-0.46%) 59229 gas (-39.39%)
approve 46638 gas 46601 gas (-0.08%) 46133 gas (-1.09%) 45939 gas (-1.52%)
safeTransferFrom 37226 gas 37924 gas (+1.84%) 36457 gas (-2.11%) 35921 gas (-3.63%)

Basically we took a small hit at the basic version to get a bigger enumerable improvement.

Closing this for now. We will publish main results in the readme after automated tests and final release of v2.