Skip to content

Commit

Permalink
Merge pull request #2561 from input-output-hk/nc/bench-tx
Browse files Browse the repository at this point in the history
Benchmarking
  • Loading branch information
nc6 committed Nov 25, 2021
2 parents 93c3dec + 1e30d44 commit 1df452b
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/tools/extract_criterion.jq
@@ -0,0 +1,3 @@
[.[2][] |
.reportName as $bench_name |
{ name: $bench_name, unit: "Nanoseconds", value: .reportAnalysis.anMean.estPoint, range: .reportAnalysis.anStdDev.estPoint }]
46 changes: 46 additions & 0 deletions .github/workflows/bench.yml
@@ -0,0 +1,46 @@
name: Ledger Benchmarks
on:
push:
branches:
- master
- nc/bench-tx

permissions:
contents: write
deployments: write

jobs:
benchmark:
name: cardano-ledger benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v15
with:
nix_path: nixpkgs=channel:nixos-unstable
extra_nix_config: |
trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
substituters = https://hydra.iohk.io https://cache.nixos.org/
- name: Build benchmarks
run: nix-build -A haskellPackages.cardano-ledger-test.components.benchmarks
- name: Run benchmark
run: |
cd libs/cardano-ledger-test
../../result/bin/bench "applyTxBenchmarks" --json bench.json
- name: Transform results
run: |
nix-env -i jq -f '<nixpkgs>'
jq -f .github/tools/extract_criterion.jq < libs/cardano-ledger-test/bench.json > output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Haskell Benchmark
tool: 'customSmallerIsBetter'
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@nc6'
1 change: 0 additions & 1 deletion cardano-protocol-tpraos

This file was deleted.

Binary file modified libs/cardano-ledger-test/bench/resources/0_ledgerstate.cbor
Binary file not shown.
Binary file modified libs/cardano-ledger-test/bench/resources/0_tx.cbor
Binary file not shown.
Binary file modified libs/cardano-ledger-test/bench/resources/1_ledgerstate.cbor
Binary file not shown.
Binary file modified libs/cardano-ledger-test/bench/resources/1_tx.cbor
Binary file not shown.
6 changes: 3 additions & 3 deletions libs/cardano-ledger-test/bench/resources/DESCRIPTION.md
Expand Up @@ -33,10 +33,10 @@ import Test.QuickCheck (generate)
import Test.Cardano.Ledger.Shelley.Generator.Trace.Ledger
let ge = genEnv (Proxy @(ShelleyEra C_Crypto))
initLs <- generate $ mkGenesisLedgerState @([[LedgerPredicateFailure (ShelleyEra C_Crypto)]]) ge undefined
initLs <- generate $ mkGenesisLedgerState @([LedgerPredicateFailure (ShelleyEra C_Crypto)]) ge undefined
tr <- generate $ traceFromInitState @(LEDGER (ShelleyEra C_Crypto)) testGlobals 20 ge (Just $ \_ -> pure initLs)
let sst = last $ sourceSignalTargets tr
BS.writeFile "/tmp/0_ledgerstate/cbor" $ serialize' (source sst)
BS.writeFile "/tmp/0_ledgerstate/cbor" $ serialize' (signal sst)
BS.writeFile "/tmp/0_ledgerstate.cbor" $ serialize' (source sst)
BS.writeFile "/tmp/0_tx.cbor" $ serialize' (signal sst)
```

0 comments on commit 1df452b

Please sign in to comment.