Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more efficient cis2 event constructors #194

Open
abizjak opened this issue Nov 21, 2022 · 0 comments
Open

Add more efficient cis2 event constructors #194

abizjak opened this issue Nov 21, 2022 · 0 comments
Labels
[Type] Change Request Some visible functionality should be change.

Comments

@abizjak
Copy link
Contributor

abizjak commented Nov 21, 2022

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.

@abizjak abizjak added the [Type] Change Request Some visible functionality should be change. label Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Change Request Some visible functionality should be change.
Projects
None yet
Development

No branches or pull requests

1 participant