-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add micro benchmarks for serialising and applying Transactions #884
Conversation
Transactions CostsSizes and execution budgets for Hydra protocol transactions. Note that unlisted parameters are currently using
Script summary
Cost of Init Transaction
Cost of Commit TransactionCurrently only one UTxO per commit allowed (this is about to change soon)
Cost of CollectCom Transaction
Cost of Close Transaction
Cost of Contest Transaction
Cost of Abort TransactionSome variation because of random mixture of still initial and already committed outputs.
Cost of FanOut TransactionInvolves spending head output and burning head tokens. Uses ada-only UTxO for better comparability.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having these benchmarks will become handy.
Besides the comments below, should we run them in CI?
hydra-node/hydra-node.cabal
Outdated
@@ -239,6 +238,27 @@ benchmark tx-cost | |||
-- NOTE(SN): should fix HLS choking on PlutusTx plugin | |||
ghc-options: -fplugin-opt PlutusTx.Plugin:defer-errors | |||
|
|||
benchmark micro | |||
import: project-config | |||
hs-source-dirs: exe/micro-bench |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually keep benchmarks in the bench/
directory within a package.
Should: use bench/
as a source directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. The other benchmark we have is in the exe
directory hence I followed suit. Happy to move them both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. tx-cost
is different than the other 3 benchmarks we have on the repository. I'd say we should move all to bench/
hydra-node/exe/micro-bench/Main.hs
Outdated
} | ||
|
||
defaultGlobals :: Ledger.Globals | ||
defaultGlobals = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should: not create another location for fixtures
This and other symbols in here seems to have been copied from the hydra-node tests component. I'm not sure what weighs more, but maybe we want to have only a single set of fixtures? The epochInfo
and pparams
fixtures are coming from the hydra-node
library already. Maybe we can create a more clear fixtures module which would make things less redundant and still not accidentally used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely copy-pasted, happy to move those to a dedicated module.
re-publication of benchmarks: It's trivial to output an html page so we could definitely do it, with the usual caveat those benchmarks are only meaningful to compare things as absolute values produced from running on a random VM environment are probably meaninglees. |
I don't mean to publish them, maybe just run them in CI first. But that would increase duration of it. That was just a thought, I'm fine with not doing anything about it. |
248d837
to
708fc48
Compare
running them without publishing or acting on them in some way is not very useful. I have added a job to publish them which should not add significant delay to the CI. |
476659b
to
a089192
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, might need some fixing with recently changed way of assembling docs.
e4ae9ab
to
83f46de
Compare
That way, we don't have to move the things later... although I'm not happy with the bench having to know too much about the doc structure but...
83f46de
to
2119d9c
Compare
Following discussions on #186 this PR adds a few micro-benchmarks to clarify what is the performance bottleneck for applying transactions to Hydra Head. Here are the results on a recent MBP with M2 chip:
Interestingly, deserialising a JSON transaction takes about half the time of applying it so it seems we have some progression margin to improve the overall head performance.