Skip to content
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

aggregateUTxOCoinByCredential benchmarks and performance tuning #2241

Merged
merged 2 commits into from
Apr 19, 2021

Commits on Apr 19, 2021

  1. Benchmarks for 'aggregateUTxOCoinByCredential'

    It was only after writing this that I noticed we already had some
    benchmarks for this function, in
    
    - https://github.com/input-output-hk/cardano-ledger-specs/blob/master/shelley/chain-and-ledger/shelley-spec-ledger-test/bench/BenchUTxOAggregate.hs
    and
    - https://github.com/input-output-hk/cardano-ledger-specs/blob/master/shelley/chain-and-ledger/shelley-spec-ledger-test/bench/Main.hs#L221
    
    However, upon examining that benchmark, I think it's still worth having
    this one (and maybe dropping the other). The existing benchmark uses
    `gen` (I believe without fixing the seed), making it hard to test the
    same case each time. And whilst we can control the size of the UTxO,
    this new benchmark allows explicit control over the key things important
    to the UTxO aggregation calculation, namely:
    - The number of base stake addresses
    - The number of pointer stake addresses (which require some additional
      computation), and
    - The "delegation" factor; i.e. the number of TxOuts for each stake
      address.
    nc6 committed Apr 19, 2021
    Configuration menu
    Copy the full SHA
    6ef64f7 View commit details
    Browse the repository at this point in the history
  2. Minor performance improvements in UTxO aggregation

    This makes a couple of minor improvements in the function
    'aggregateUtxoCoinByCredential', as measured by the new benchmark
    introduced.
    
    I tried a few variants; see
    https://drive.google.com/drive/u/1/folders/1o7r4EF0uM5gfhtf3_GoMSJdoHc_d6Xtc
    for the full reports. This version seems to shave maybe 20% off of the
    20K UTxO run.
    
    Interestingly, a variant where we try to explicitly deserialise only the
    stake ref (using `deserialiseAddrStakeRef`) was _considerably_ slower.
    I'm not immediately sure why!
    nc6 committed Apr 19, 2021
    Configuration menu
    Copy the full SHA
    b4d3148 View commit details
    Browse the repository at this point in the history