-
Notifications
You must be signed in to change notification settings - Fork 465
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
[Builtins] Add 'ListToConstr' and 'DataToConstr' #5704
base: master
Are you sure you want to change the base?
Conversation
/benchmark plutus-benchmark:lists |
Click here to check the status of your benchmark. |
…to effectfully/builtins/add-ListToConstr
/benchmark plutus-benchmark:lists |
Click here to check the status of your benchmark. |
Comparing benchmark results of 'plutus-benchmark:lists' on 'b8a74e7b4' (base) and '9d99fc6ed' (PR) Results table
|
/benchmark plutus-benchmark:lists |
Click here to check the status of your benchmark. |
Comparing benchmark results of 'plutus-benchmark:lists' on 'b8a74e7b4' (base) and 'a8183017d' (PR) Results table
|
/benchmark plutus-benchmark:lists |
Click here to check the status of your benchmark. |
Comparing benchmark results of 'plutus-benchmark:lists' on 'b8a74e7b4' (base) and 'a8183017d' (PR) Results table
|
This is a competitor of #5486, let's see how it performs.
This adds the
listToConstr
builtin whose Plutus type isThe idea is that we can use this builtin to implement faster pattern matching over built-in lists by piggy-backing on
case
that we use for pattern matching over sums-of-products:Implementation-wise this requires us to add the following class:
and add it to
HasMeaningIn uni val
.The meaning of the
listToConstr
builtin is implemented as follows:i.e. it simply turns the outer constructor of a list into an SOP term leaving all other constructors of the list intact.
The only interesting remaining part is that we make
matchList
anInternal
builtin (i.e. aNOINLINE
one) and tell the plugin to replace that builtin with the definition ofmatchList
given above.