Skip to content

Allow contract interface types in intersection types #4741

Allow contract interface types in intersection types

Allow contract interface types in intersection types #4741

Workflow file for this run

name: Benchmark
on:
push:
branches:
- master
- 'feature/**'
- 'v**'
pull_request:
branches:
- master
- 'feature/**'
- 'v**'
env:
GO_VERSION: '1.20'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
benchmark:
name: Performance regression check
runs-on: ubuntu-latest
steps:
- name: Set benchmark repetitions
# reducing repetition will speed up execution,
# but will be more inaccurate at detecting change
run: echo "benchmark_repetitions=7" >> "$GITHUB_OUTPUT"
id: settings
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install wabt
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Build
run: make -j8 build
- name: Run benchmark on current branch
run: |
( for i in {1..${{ steps.settings.outputs.benchmark_repetitions }}}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done | sed 's/pkg:.*/pkg: github.com\/onflow\/cadence\/runtime/' ) | tee new.txt
# the package replace line above is to make the results table more readable, since it is not fragmented by package
- name: Checkout base branch
run: git checkout ${{ github.event.pull_request.base.sha }}
- name: Run benchmark on base branch
run: |
( for i in {1..${{ steps.settings.outputs.benchmark_repetitions }}}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done | sed 's/pkg:.*/pkg: github.com\/onflow\/cadence\/runtime/' ) | tee old.txt
# see https://trstringer.com/github-actions-multiline-strings/ to see why this part is complex
- name: Use benchstat for comparison
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go install golang.org/x/perf/cmd/benchstat@91a04616dc65ba76dbe9e5cf746b923b1402d303
echo "BENCHSTAT<<EOF" >> $GITHUB_ENV
echo "$(benchstat -html -sort name old.txt new.txt | sed '/<title/,/<\/style>/d' | sed 's/<!doctype html>//g')" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Find existing comment on PR
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "## Cadence [Benchstat](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat) comparison"
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
## Cadence [Benchstat](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat) comparison
This branch with compared with the base branch ${{ github.event.pull_request.base.label }} commit ${{ github.event.pull_request.base.sha }}
The command `for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done` was used.
Bench tests were run a total of ${{ steps.settings.outputs.benchmark_repetitions }} times on each branch.
<details>
<summary>Collapsed results for better readability</summary>
<p>
${{ env.BENCHSTAT }}
</p>
</details>
edit-mode: replace