scalus.uplc.transform

Members list

Type members

Classlikes

Replace nested Apply with Case/Constr

Replace nested Apply with Case/Constr

For example, replace (apply (apply (apply f a) b) c) with (case (constr 0 [a, b, c]) f). This is more memory/cpu efficient than nested Apply at least in Plutus V3 Plomin HF, protocol version 10.

With current machine costs, Apply costs 100 memory and 16000 cpu, same for Case/Constr. Hence (case (constr 0 [a, b, c]) f) costs 200 memory and 32000 cpu, while (apply (apply (apply f a) b) c) costs 300 memory and 48000 cpu.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object EtaReduce

Performs eta-reduction on a term.

Performs eta-reduction on a term.

Attributes

See also
Supertypes
class Object
trait Matchable
class Any
Self type
EtaReduce.type

Extract forced builtins to top level

Extract forced builtins to top level

For example, replace (force (force (builtin fstPair))) with (lam builtin_FstPair (builtin_FstPair (pair true false)) (! (! __builtin_FstPair))). This is more memory/cpu efficient than nested Force at least in Plutus V3 Plomin HF, protocol version 10.

With current machine costs, Force costs 100 memory and 16000 cpu, same for Builtin. Hence (lam builtin_FstPair (builtin_FstPair (pair true false)) (! (! __builtin_FstPair))) costs 200 memory and 32000 cpu, while (force (force (builtin fstPair))) costs 300 memory and 48000 cpu.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Inliner

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Inliner.type