Add Data.Constr casing to Case - #7914
Conversation
67382f3 to
d20120e
Compare
Execution Budget Golden Diffoutputplutus-benchmark/coop/test/9.6/authMpBurning.golden.eval
plutus-benchmark/coop/test/9.6/authMpMinting.golden.eval
plutus-benchmark/coop/test/9.6/certMpBurning.golden.eval
plutus-benchmark/coop/test/9.6/certMpMinting.golden.eval
plutus-benchmark/coop/test/9.6/fsMpBurning.golden.eval
plutus-benchmark/coop/test/9.6/fsMpMinting.golden.eval
plutus-benchmark/coop/test/9.6/mustBurnOwnSingleton.golden.eval
plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-20.golden.eval
plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext1-4.golden.eval
plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-20.golden.eval
plutus-benchmark/script-contexts/test/V1/9.6/checkScriptContext2-4.golden.eval
plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-20.golden.eval
plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext1-4.golden.eval
plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-20.golden.eval
plutus-benchmark/script-contexts/test/V2/9.6/checkScriptContext2-4.golden.eval
plutus-benchmark/script-contexts/test/V2/9.6/sopFwdStakeTrick.golden.eval
plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-20.golden.eval
plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext1-4.golden.eval
plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-20.golden.eval
plutus-benchmark/script-contexts/test/V3/9.6/checkScriptContext2-4.golden.eval
plutus-benchmark/script-contexts/test/V3/Data/9.6/purposeIsWellFormed-4.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/geq1.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/geq2.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/geq3.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/geq4.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/geq5.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/gt1.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/gt2.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/gt3.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/gt4.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.12/gt5.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/geq1.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/geq2.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/geq3.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/geq4.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/geq5.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/gt1.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/gt2.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/gt3.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/gt4.golden.eval
plutus-tx-plugin/test-ledger-api/Spec/Data/Budget/9.6/gt5.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.12/destructSum.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.12/richSumA.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.12/richSumB.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.12/richSumC.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.6/destructSum.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.6/richSumA.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.6/richSumB.golden.eval
plutus-tx-plugin/test/AsData/Budget/9.6/richSumC.golden.eval
plutus-tx-plugin/test/Budget/9.12/map3.golden.eval
plutus-tx-plugin/test/Budget/9.12/toFromData.golden.eval
plutus-tx-plugin/test/Budget/9.6/map3.golden.eval
plutus-tx-plugin/test/Budget/9.6/toFromData.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodeA.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodeC.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodeMixedNone.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodeMixedTwo.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodePairA.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodePairB.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.12/decodeSingle.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodeA.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodeC.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodeMixedNone.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodeMixedTwo.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodePairA.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodePairB.golden.eval
plutus-tx-plugin/test/IsData/Budget/SoP/9.6/decodeSingle.golden.eval
This comment will get updated when changes are made. |
d20120e to
89ea27d
Compare
| {-# OPAQUE wrapUnsafeDataAsConstr #-} | ||
|
|
||
| wrapCaseData :: BuiltinData -> [BuiltinList BuiltinData -> a] -> a | ||
| wrapCaseData = BI.caseData |
There was a problem hiding this comment.
Are you sure we need this? It's possible that neither this nor wrapUnsafeDataAsConstr is needed any more.
If we do, then this needs to be mentioned in the Note below.
There was a problem hiding this comment.
If we don't have this, inliner won't inline the bindings it makes for each fields which prevents DeadCase and CollapseCase pass from running. Can't really think of other ways to make this work better
There was a problem hiding this comment.
On the side note, this method only works on quite specific case where each handler of the match must be lambda directly like so:
matchRich ...
(\a b c -> ...)
(\x y z k -> ...)
...
if we have non-lambda handler, this doesn't work at all!
let f = \a b c -> ...
in matchRich ...
f
(\x y z k -> ...)
...
All fields gets bounded for f.
There was a problem hiding this comment.
We could retire the matcher and try to optimize pattern matching in the plugin. The matcher is already inconvenient to begin with, compared to direct pattern matching. May not be easy to do though.
zliu41
left a comment
There was a problem hiding this comment.
It otherwise looks good, but this new feature must be gated by dijkstraPV, and I don't think it is gated properly.
|
Do we need this to be gated by dijkstra? I don't think adding this to older PV with builtin casing would have any issue. What do you think? |
Yes otherwise old node version rejects casing on Constr, new node version accepts it. |
I discarded this idea originally as most of the cost would've been in the deconstruction of fields(
xshere). However, introduction ofDropListmade deconstruction ofxsreasonable fast so this approach actually gives a decent performance boost with minimal change!