You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The order of declaration of variables in storage and the order of fields in structs are relevant to their ultimate size. Storage variables that have combined sizes less than one word can be packed into a single storage slot, which can reduce the number of storage slots used, especially if they are often read or written together anyway. The same goes for struct fields, where sequential fields can be packed into one slot if they are small enough.
This can be applied in the following places:
The vp field of the Member struct could be reduced to a uint96 so the entire struct would occupy one word. 96 bits of precision is likely sufficient to measure the voting power of a user.
The Proposal struct's fields can be reordered to reduce its size to 4 words instead of 5.
The order of storage variables in the Space contract can be reordered to occupy fewer slots.
The text was updated successfully, but these errors were encountered:
The order of declaration of variables in storage and the order of fields in structs are relevant to their ultimate size. Storage variables that have combined sizes less than one word can be packed into a single storage slot, which can reduce the number of storage slots used, especially if they are often read or written together anyway. The same goes for struct fields, where sequential fields can be packed into one slot if they are small enough.
This can be applied in the following places:
The text was updated successfully, but these errors were encountered: