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
Currently the CIS2 library provides an CIS2Event type which owns all the values.
However in practice in smart contracts these events are generally only constructed to be emitted by logs. As result owning values is needlessly inefficient since it involves using an allocator, and copying them into Wasm heap twice. Once when reading the relevant data (e.g., metadataURL from the contract state, and then when cloning it).
It would be useful to have a "borrowed" variant of this so that the type itself would just work as a skeleton that would contain pointers to the actual data, to avoid copying it.
This in particular applies to TokenMetadata event.
But events which take token ids could also likely be optimized, especially in case of large token ids.
Measurements should be made to see if there is any (and if so, how much) NRG savings.
The text was updated successfully, but these errors were encountered:
Description
Currently the CIS2 library provides an CIS2Event type which owns all the values.
However in practice in smart contracts these events are generally only constructed to be emitted by logs. As result owning values is needlessly inefficient since it involves using an allocator, and copying them into Wasm heap twice. Once when reading the relevant data (e.g., metadataURL from the contract state, and then when cloning it).
It would be useful to have a "borrowed" variant of this so that the type itself would just work as a skeleton that would contain pointers to the actual data, to avoid copying it.
This in particular applies to
TokenMetadata
event.But events which take token ids could also likely be optimized, especially in case of large token ids.
Measurements should be made to see if there is any (and if so, how much) NRG savings.
The text was updated successfully, but these errors were encountered: