File: benchmark.yml

package info (click to toggle)
golang-github-segmentio-encoding 0.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 14,468 kB
  • sloc: makefile: 286
file content (63 lines) | stat: -rw-r--r-- 1,457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
name: Benchmark

"on":
  - pull_request

jobs:
  benchmark:
    strategy:
      matrix:
        ref:
          - master
          - ${{ github.sha }}

    runs-on: ubuntu-latest

    steps:
      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: "1.24"

      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ matrix.ref }}

      - name: Run Benchmarks
        # Without 6 iterations, benchstat will claim statistical insignificance.
        run: go test -v -run '^$' -bench '(Marshal|Unmarshal)$/codeResponse' -benchmem -benchtime 3s -cpu 1 -count 6 ./json | tee bench.txt

      - name: Upload Benchmarks
        uses: actions/upload-artifact@v4
        with:
          name: ${{ matrix.ref }}
          path: bench.txt

  benchstat:
    needs: [benchmark]
    runs-on: ubuntu-latest

    steps:
      - name: Setup Go
        uses: actions/setup-go@v2
        with:
          go-version: "1.24"

      - name: Setup Benchstat
        run: go install golang.org/x/perf/cmd/benchstat@latest

      - name: Download Benchmark Results
        uses: actions/download-artifact@v4
        with:
          path: .

      - name: Run Benchstat
        run: benchstat ./master/bench.txt ./${{ github.sha }}/bench.txt | tee benchstat.txt

      - name: Upload Benchstat Results
        uses: actions/upload-artifact@v4
        with:
          name: benchstat
          path: benchstat.txt