IntersectMBO / IntersectMBO/plutus

UPLC case-of-case improvements

Open
#5,966 5 comments 0 reactions 0 assignees View on GitHub
Internal optimization status: triaged tech debt
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

After #5960 we have some left-overs:

1. this example is incorrect and needs to be updated:

```
{- | A special case of case-of-case optimisation: transforms

@
case ((force ifThenElse) b (constr t) (constr f)) alts
@

into

@
force ifThenElse b (case (constr t) alts) (case (constr f) alts)
@

This is always an improvement.
-}
```

Plus, there's no explanation of what we do and why we do it.

2. the PR added generation of extra `force`-`delay` pairs, why don't we see them in the existing golden tests? Those that were affected by the [original](https://github.com/IntersectMBO/plutus/pull/5337) PR introducing case-of-case? UPD: @ana-pantilie figured it out: it's because we know how case-of-case in PIR and so no suitable expression survives compilation of PIR to be transformed at the UPLC level. Thanks Ana!

3. should we avoid generating `force`-`delay` pairs when branches are pure?

4. what about PIR, do we have the same issue there that was fixed for UPLC?

5. UPLC case-of-case is exponential in the same way as PIR case-of-case (see [this](https://github.com/IntersectMBO/plutus/issues/6183#issuecomment-2187973135) and below).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.