Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
axatbhardwaj authored Dec 16, 2022
1 parent 8c78b72 commit 72bf94a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ Ans. No, storing a small number in a uint8 variable is not cheaper than storing

- Use mapping whenever possible, it's cheap instead of the array
- But an array could be a good choice if you have a small array
- Fixed size variables are always cheaper than dynamic ones.
- If we know how long an array should be, we specify a fixed size
- This same rule applies to strings. A string or bytes variable is dynamically sized; we should use a byte32 if our string is short enough to fit.
- If we absolutely need a dynamic array, it is best to structure our functions to be additive instead of subractive. Extending an array costs constant gas whereas truncating an array costs linear gas.

## Functions

Expand Down

0 comments on commit 72bf94a

Please sign in to comment.