IntersectMBO / plutus

The Plutus language implementation and tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Epic] AST optimizations

effectfully opened this issue · comments

This issue is for dumping all the plans regarding AST optimizations (such as case-of-case, case-of-known-constructors etc) in a largely unstructured way. We'll have separate messages for Plutus Core and Plutus IR, please just edit those instead of creating more messages.

Plutus Core

  • in (\x -> s s x) (addInteger 1 i) xs we could eta-contract the head to s s. This potentially changes the order of effects, though
  • speaking of order of effects, we should figure out a strategy for when it's fine to change it and when it's not. It's worth handling logging and bottom separately, since messing with the former is OK (given it's locked behind a flag not enabled by default) and messing with the latter is a no-no
  • handle chooseList in case-of-case similarly to ifThenElse?
  • we need a test that the inliner inline blah in (\b -> force ifThenElse b branch1 branch2) blah. If it doesn't, we should implement that functionality
  • Aiken folks gave us an idea: try replacing Scott-encoded tuples with SOP-encoded tuples in the recursive functions combinators, SOP-encoded tuples should be faster thus making mutual recursion faster. If there’s anything else Scott-encoded there, we should change it too. Perhaps we could update the entire PlutusCore.StdLib.Meta.Data.Tuple. We have to keep the old code too for older versions of Plutus

Plutus IR