openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Optimize nested mapping access in ERC721Enumerable

Open 0xVolosnikov opened this issue 2 years ago • 1 comments

Optimized access to nested mapping: avoiding the need to calculate the index of a slot in the storage several times.

  • [X] Tests
  • [X] Documentation
  • [X] Changeset entry (run npx changeset add)

0xVolosnikov avatar Aug 28 '23 11:08 0xVolosnikov

⚠️ No Changeset found

Latest commit: 0edf4db971f2a50a542d6de5b5ec493776a5ee79

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Aug 28 '23 11:08 changeset-bot[bot]

I'm not a big fan of this syntax, which I find less readable ... but it saves 76gas on some run.

@ernestognw WDYT?

Also not a fan of the syntax, but I think it's pretty much what we intended here and I'd rather keep the gas savings since I don't see how this might be dangerous or something.

ernestognw avatar Mar 25 '24 12:03 ernestognw