Skip to content

Commit

Permalink
.github: run benchmarks in CI environment
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinburkesegment committed Apr 26, 2022
1 parent aee0221 commit 0eb1ec1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/benchmark.yml
@@ -0,0 +1,22 @@
name: Go

on:
push:
branches:
- 'main'

jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.18.x

- name: Run benchmarks
run: |
go install golang.org/x/perf/cmd/benchstat@latest
make benchcmp count=1
9 changes: 6 additions & 3 deletions Makefile
@@ -1,3 +1,5 @@
SHELL = /bin/bash

dstdir := $(CURDIR)
srcdir := $(CURDIR)/build

Expand All @@ -16,10 +18,11 @@ build: $(targets)

count ?= 5
bench ?= .
pkg ?= ...
benchcmp:
go test -v -run _ -count $(count) -bench $(bench) ./$(pkg) -tags purego | tee /tmp/bench-$(pkg)-purego.txt
go test -v -run _ -count $(count) -bench $(bench) ./$(pkg) | tee /tmp/bench-$(pkg)-asm.txt
benchstat /tmp/bench-$(pkg)-{purego,asm}.txt
go test -v -run _ -count $(count) -bench $(bench) ./$(pkg) -tags purego > /tmp/bench-$(subst .,dot,$(pkg))-purego.txt
go test -v -run _ -count $(count) -bench $(bench) ./$(pkg) > /tmp/bench-$(subst .,dot,$(pkg))-asm.txt
benchstat /tmp/bench-$(subst .,dot,$(pkg))-{purego,asm}.txt

$(dstdir)/%_amd64.s $(dstdir)/%_amd64.go: $(srcdir)/%_asm.go $(internal)
cd build && go run $(patsubst $(CURDIR)/build/%,%,$<) \
Expand Down

0 comments on commit 0eb1ec1

Please sign in to comment.