[Epic] CEK machine optimizations
effectfully opened this issue · comments
effectfully commented
This issue is for dumping all the plans regarding optimization of the CEK machine in a largely unstructured way.
effectfully commented
- we should try specializing the CEK machine at the
restricting
ExBudgetMode
as it's the one that is used in production and having that code specialized may impact performance significantly -
Data.RandomAccessList.Class.indexOne
returns aMaybe
, a strictEvaluationResult
instead would be more efficient - GHC Core for
UntypedPlutusCore.Evaluation.Machine.Cek.ExBudgetMode
contains unnecessary packing and unpacking, for example0# -> jump $j_sGXo r#_iGvO (I# r#_iGvO)
-
UntypedPlutusCore.Evaluation.Machine.Cek.Internal
for theVector
-basedCase
-expressions is unoptimized: it contains things likeint2Word#
followed by aword2Int#
(i.e. a non-free no-op) and what looks like an unnecessary call tointegerFromWord64#
- Is it possible to support join points in the CEK machine? The "Compiling without continuations" paper seems to say “yes”. If we had join points, we could’ve better implemented case-of-case (as per the paper) and possibly CSE
- currently we implement the stack in the CEK machine as a pure data structure, but it is conceivable that a mutable one would be faster, so we should try it out. Doesn’t seem to be too complicated, given that the CEK machine runs in the ST monad anyway.
- currently we use
Vector
inFrameCases
. Would it be more efficient to useArray
/SmallArray
/custom data/manual loop unrolling?