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 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.
The text was updated successfully, but these errors were encountered:
This issue implements AssocMap encoded in BuiltinData. That way one can use AssocMap in asData datatypes. For same reason one needs List encoded in BuiltinData, to use lists in asData datatypes. Is that not correct?
I think that asData translation could change regular SOP-encoded lists to such BuiltinData-backed lists. But may be I am wrong.
From @zliu41 :
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.
The text was updated successfully, but these errors were encountered: