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
Wanted to understand the purpose of keyList. Its only updated when an address is being mapped mapAddress but not being updated when an address is being unmapped removeMappedAddress. That leads to creating a larger map than required in getMappedAddresses as the length of keyList doesn't decrease when addresses are unmapped.
Is the objective with keyList to track all addresses ever mapped? If yes, then wouldn't it be efficient to have keyList be a map supplemented with 1 or 2 counters to track how many addresses were ever mapped and how many are currently mapped. That way a call to mapAddress does not have to iterate over keyList.
The text was updated successfully, but these errors were encountered:
Wanted to understand the purpose of
keyList
. Its only updated when an address is being mappedmapAddress
but not being updated when an address is being unmappedremoveMappedAddress
. That leads to creating a larger map than required ingetMappedAddresses
as the length ofkeyList
doesn't decrease when addresses are unmapped.Is the objective with
keyList
to track all addresses ever mapped? If yes, then wouldn't it be efficient to havekeyList
be a map supplemented with 1 or 2 counters to track how many addresses were ever mapped and how many are currently mapped. That way a call tomapAddress
does not have to iterate overkeyList
.The text was updated successfully, but these errors were encountered: