hydra icon indicating copy to clipboard operation
hydra copied to clipboard

DONT MERGE: Plutus tx inline conservative optimization

Open ch1bo opened this issue 1 year ago • 3 comments

According to https://github.com/IntersectMBO/plutus/issues/5460 this should be enough to ensure traces are not simplified away, but still allow for some simplifications and potential smaller / faster code.


  • [x] CHANGELOG updated
  • [x] Documentation update not needed
  • [x] Haddocks update not needed
  • [x] No new TODOs introduced

ch1bo avatar May 23 '24 11:05 ch1bo

Transactions Costs

Sizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using arbitrary values and results are not fully deterministic and comparable to previous runs.

Metadata
Generated at 2024-05-23 12:10:29.323307767 UTC
Max. memory units 14000000
Max. CPU units 10000000000
Max. tx size (kB) 16384

Script summary

Name Hash Size (Bytes)
νInitial e3f5b84be0f577c06dce9f6d1443cd81242bb46befe05418c6d105cd 3838
νCommit ecb1dda1e2e7575b01ad665ab360426826ddfe61b596fd2dad483072 1743
νHead 1d80640c56a121b61f9cc5dfffa8178b45521568d5075337eeca2efa 8681
μHead 4205243a3bccdb144bab86f95b46cee42f41e2f5838f3f81e55d1d80* 3855
  • The minting policy hash is only usable for comparison. As the script is parameterized, the actual script is unique per Head.

Cost of Init Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 4434 9.66 3.69 0.45
2 4637 11.87 4.54 0.48
3 4836 14.34 5.50 0.52
5 5245 18.31 7.01 0.58
10 6250 28.79 11.02 0.74
43 12879 98.91 37.91 1.79

Cost of Commit Transaction

This is using ada-only outputs for better comparability.

UTxO Tx size % max Mem % max CPU Min fee ₳
1 559 9.77 3.89 0.28
2 749 13.21 5.43 0.33
3 933 16.78 7.01 0.38
5 1304 24.30 10.31 0.48
10 2238 45.35 19.39 0.75
20 4114 97.11 41.10 1.41

Cost of CollectCom Transaction

Parties UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
1 57 544 20.68 8.10 0.40
2 113 654 31.66 12.54 0.53
3 171 764 44.25 17.71 0.67
4 226 878 61.78 24.82 0.87
5 282 984 74.52 30.26 1.01
6 338 1095 88.17 36.16 1.17

Cost of Close Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 591 16.71 7.67 0.37
2 745 17.97 8.94 0.39
3 933 19.72 10.56 0.43
5 1215 22.40 13.15 0.48
10 2086 30.69 20.98 0.64
50 8156 89.93 77.36 1.79

Cost of Contest Transaction

Parties Tx size % max Mem % max CPU Min fee ₳
1 614 20.30 8.97 0.41
2 786 21.89 10.37 0.44
3 895 23.32 11.66 0.46
5 1110 25.94 14.02 0.51
10 1811 33.90 21.07 0.66
47 7532 97.61 76.93 1.82

Cost of Abort Transaction

Some variation because of random mixture of still initial and already committed outputs.

Parties Tx size % max Mem % max CPU Min fee ₳
1 4226 14.20 5.90 0.49
2 4408 25.67 11.06 0.63
3 4597 43.33 19.08 0.84
4 4819 61.37 27.13 1.05
5 4881 73.91 32.61 1.20
6 4988 99.23 43.96 1.49

Cost of FanOut Transaction

Involves spending head output and burning head tokens. Uses ada-only UTxO for better comparability.

Parties UTxO UTxO (bytes) Tx size % max Mem % max CPU Min fee ₳
5 0 0 4269 7.52 3.17 0.42
5 1 57 4304 8.41 3.78 0.43
5 5 285 4440 13.03 6.65 0.50
5 10 569 4609 18.83 10.26 0.58
5 20 1137 4947 29.34 17.02 0.73
5 30 1707 5288 40.36 23.99 0.88
5 40 2274 5625 51.60 31.06 1.04
5 50 2846 5968 62.42 37.96 1.19
5 83 4720 7082 98.65 60.94 1.70

End-To-End Benchmark Results

This page is intended to collect the latest end-to-end benchmarks results produced by Hydra's Continuous Integration system from the latest master code.

Please take those results with a grain of salt as they are currently produced from very limited cloud VMs and not controlled hardware. Instead of focusing on the absolute results, the emphasis should be on relative results, eg. how the timings for a scenario evolve as the code changes.

Generated at 2024-05-23 12:14:35.024994695 UTC

Baseline Scenario

Number of nodes 1
Number of txs 3000
Avg. Confirmation Time (ms) 3.962116282
P99 9.817799179999987ms
P95 4.755882149999999ms
P50 3.7236314999999998ms
Number of Invalid txs 0

Three local nodes

Number of nodes 3
Number of txs 9000
Avg. Confirmation Time (ms) 21.044905753
P99 111.46006578000004ms
P95 29.751192199999995ms
P50 18.5038995ms
Number of Invalid txs 0

github-actions[bot] avatar May 23 '24 11:05 github-actions[bot]

Test Results

427 tests  ±0   419 :white_check_mark: ±0   15m 33s :stopwatch: +39s 139 suites ±0     8 :zzz: ±0    2 files   ±0     0 :x: ±0 

Results for commit 821d541e. ± Comparison against base commit 13e596f0.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar May 23 '24 11:05 github-actions[bot]

Seems like the script sizes indeed became smaller, but the memory costs are higher. Maybe not desirable to do this!

ch1bo avatar May 23 '24 12:05 ch1bo