IntersectMBO / plutus-apps

The Plutus application platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve performance of `fromOnChainTx`

koslambrou opened this issue · comments

Description

As a plutus-apps emulator user

I want an efficient version of fromOnChainTx

so that I waste as little time as possible when I run the emulator.

Technical details

After the first investigation of https://input-output.atlassian.net/browse/PLT-1026 (emulator performance regression following merge from next-node to main), fromOnChainTx takes 10% of the time of a whole plutus-use-cases run.

Here is an excerpt of the prof file that illustrates the costs of the calls inside fromOnChainTx:

fromOnChainTx                  Plutus.ChainIndex.Tx            src/Plutus/ChainIndex/Tx.hs:(94,1)-(126,15)             359402           0    0.0    0.0     1.6    2.3
 onCardanoTx                   Ledger.Tx                       src/Ledger/Tx.hs:(306,1)-(307,42)                       359403        9280    0.0    0.0     1.6    2.3
  fromCardanoTx                Plutus.Contract.CardanoAPI      src/Plutus/Contract/CardanoAPI.hs:(38,1)-(67,13)        359404        9280    0.0    0.0     1.5    2.2
   plutusScriptsFromTxBody     Ledger.Tx.CardanoAPI.Internal   src/Ledger/Tx/CardanoAPI/Internal.hs:(372,1)-(374,68)   359430        9280    0.0    0.0     1.5    2.2
    fromLedgerScript           Ledger.Tx.CardanoAPI.Internal   src/Ledger/Tx/CardanoAPI/Internal.hs:(383,1)-(387,80)   371410        2460    0.0    0.0     1.5    2.2
     fromLedgerPlutusScript    Ledger.Tx.CardanoAPI.Internal   src/Ledger/Tx/CardanoAPI/Internal.hs:(392,1)-(404,40)   371411        2460    0.0    0.0     1.5    2.2