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

Write an efficient Map backed by Data #5998

Closed
zliu41 opened this issue May 15, 2024 · 1 comment
Closed

Write an efficient Map backed by Data #5998

zliu41 opened this issue May 15, 2024 · 1 comment

Comments

@zliu41
Copy link
Member

zliu41 commented May 15, 2024

AsData doc: #5729

The goal is to create a Map for Plutus Tx that is encoded in BuiltinData. In contrast, PlutusTx.AssocMap wraps a regular list encoded in SOP.

Using AsData on PlutusTx.AssocMap won’t be effective, because it is backed by a regular (SOP-encoded) list, not a data-encoded list. If we simply wrap the PlutusTx.AssocMap.Map definition in AsData, it would become less, not more efficient, because two frequent operations, wrapping and unwrapping (via toList and fromList ) will be linear (converting an SOP list to or from Data).

Instead, we should implement all operations for the new Map type such that they do not involve regular lists.

I have an initial implementation but didn’t finish addressing all the comments: #5701 Please take it from there.

Once we are done with Map, we will be ready to wrap the ScriptContext types (for V1, V2 and V3) in AsData, which will significantly speed up scripts that only access a small portion of the script context.

Extricated from https://input-output.atlassian.net/browse/PLT-7744

@github-actions github-actions bot added the status: needs triage GH issues that requires triage label May 15, 2024
@zliu41 zliu41 removed the status: needs triage GH issues that requires triage label May 15, 2024
@zliu41 zliu41 closed this as completed May 16, 2024
@zliu41
Copy link
Member Author

zliu41 commented May 16, 2024

Duplicated of #5929

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant