Comparison

While trying to implement all validators as closely to each other as possible there are some differences that impact measured script size and execution units.

  • Plutarch while decoding Data-encoded types is checking for invariants such as hashes lengths, map key ordering etc. which leads to higher start up cost visible in NFT Marketplace validator.
  • Opshin does expose option to compile without tracing so that is included in the final size. All implementations use traces in their source code but remaining allow to strip it with a compilation flag.

Script size (bytes)

Script sizes are compared by compiling each script to CBOR and taking its binary size in bytes. Validators are compiled without traces if language supports it (Opshin does not) and are not passed through any external UPLC optimizer.

size plot

Languagelp-minting-policy.binnft-marketplace-validator.binnft-minting-policy.binpool-validator.bin
Plutarch33412196401631
Aiken5357957811550
PlutusTx1848343323793171
Opshin1412263420024169

Raw script size data

Execution Units

Execution units are abstract units of CEK machine. Despite being called CPU and Memory they DO NOT mean CPU cycles or allocated bytes, these are abstract, deterministic units of the virtual machine that executes UPLC.

LP Policy - mint one

execution_units plot

LanguageCPUMemory
Plutarch2186615654994
Aiken2908964683264
PlutusTx112521772369282
Opshin49371325153098

Raw execution units data

LP Policy - mint two

execution_units plot

LanguageCPUMemory
Plutarch3775657290081
Aiken45968980130219
PlutusTx129561365424596
Opshin78653774234077

Raw execution units data

Pool NFT Policy - mint

execution_units plot

LanguageCPUMemory
Plutarch2949736176787
Aiken3716775199173
PlutusTx153008441504397
Opshin56304254182358

Raw execution units data

Pool Validator - swap A for B

execution_units plot

LanguageCPUMemory
Plutarch153757103376495
Aiken160591359442544
PlutusTx4346053391492262
Opshin328459639936125

Raw execution units data

Pool Validator - swap B for A

execution_units plot

LanguageCPUMemory
Plutarch153757103376495
Aiken160591359442544
PlutusTx4346053391492262
Opshin328459639936125

Raw execution units data

Pool Validator - deposit

execution_units plot

LanguageCPUMemory
Plutarch155335291379259
Aiken166710755461160
PlutusTx4881351511682058
Opshin332265515940848

Raw execution units data

Pool Validator - withdraw

execution_units plot

LanguageCPUMemory
Plutarch156466269381663
Aiken167841733463564
PlutusTx4895326501686860
Opshin333153004943450

Raw execution units data

NFT Marketplace - buy one

execution_units plot

LanguageCPUMemory
Plutarch44577866125010
Aiken3065588280452
PlutusTx216310996739238
Opshin60101506192397

Raw execution units data

NFT Marketplace - cancel one

execution_units plot

LanguageCPUMemory
Plutarch38719357115390
Aiken2400584271296
PlutusTx133127717443664
Opshin43609505143722

Raw execution units data