Skip to content

Benchmarks

Benchmarks #240

Workflow file for this run

name: Benchmarks
on:
workflow_dispatch:
schedule:
- cron: "0 12 * * *"
permissions:
deployments: write
contents: write
jobs:
build:
name: Go Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Setup Linux Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-dev and xorg-dev
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: stable
id: go
- name: Should Run Benchmarks
id: should_run_benchmarks
run: |
if git show -s --format=%ae HEAD | grep -q "[^@]*\.github\.com"; then
echo "should_run=false" >> $GITHUB_OUTPUT
else
echo "should_run=true" >> $GITHUB_OUTPUT
fi
- name: Running Common Benchmarks
if: steps.should_run_benchmarks.outputs.should_run == 'true'
run: |
go test ./pkg/search/... -short -bench BenchmarkDebugSimilarity -run BenchmarkDebugSimilarity -benchmem > output.txt
go test ./internal/search/... -short -bench Benchmark_Search/dynamic -run Benchmark_Search -benchmem >> output.txt
go test ./internal/search/... -short -bench BenchmarkAPI_Search -run BenchmarkAPI_Search -benchmem >> output.txt
go test ./internal/stringscore/... -short -bench Benchmark -run Benchmark -benchmem >> output.txt
go test ./internal/postalpool/... -short -bench BenchmarkPostalPool -run BenchmarkPostalPool -benchmem >> output.txt
go test ./internal/norm/... -short -bench Bench -run Bench -benchmem >> output.txt
- name: Log Failure
if: ${{ failure() }}
run: cat ./output.txt
- name: Store benchmark result
if: steps.should_run_benchmarks.outputs.should_run == 'true'
uses: benchmark-action/github-action-benchmark@v1
with:
name: "moov-io/watchman Common Benchmarks"
tool: 'go'
output-file-path: "./output.txt"
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-fetch-gh-pages: true
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '120%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@adamdecaf'
max-items-in-chart: 25
# Update files on master branch
gh-pages-branch: master
benchmark-data-dir-path: "docs/bench/common/"
- name: Running OFAC Benchmarks
if: steps.should_run_benchmarks.outputs.should_run == 'true'
run: |
go test ./pkg/sources/ofac/... -short -bench Benchmark -run Benchmark -benchmem > output.txt
- name: Log Failure
if: ${{ failure() }}
run: cat ./output.txt
- name: Store OFAC results
if: steps.should_run_benchmarks.outputs.should_run == 'true'
uses: benchmark-action/github-action-benchmark@v1
with:
name: "moov-io/watchman OFAC Benchmarks"
tool: 'go'
output-file-path: "./output.txt"
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-fetch-gh-pages: true
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '120%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@adamdecaf'
max-items-in-chart: 25
# Update files on master branch
gh-pages-branch: master
benchmark-data-dir-path: "docs/bench/sources/ofac/"
- name: Running CSL US Benchmarks
if: steps.should_run_benchmarks.outputs.should_run == 'true'
run: |
go test ./pkg/sources/csl_us/... -short -bench Benchmark -run Benchmark -benchmem > output.txt
- name: Log Failure
if: ${{ failure() }}
run: cat ./output.txt
- name: Store CSL US results
if: steps.should_run_benchmarks.outputs.should_run == 'true'
uses: benchmark-action/github-action-benchmark@v1
with:
name: "moov-io/watchman CSL US Benchmarks"
tool: 'go'
output-file-path: "./output.txt"
github-token: ${{ secrets.GITHUB_TOKEN }}
skip-fetch-gh-pages: true
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '120%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@adamdecaf'
max-items-in-chart: 25
# Update files on master branch
gh-pages-branch: master
benchmark-data-dir-path: "docs/bench/sources/csl_us/"
# TODO(adam): include libpostal benchmarks
# make install
# go test -tags libpostal ./pkg/address/... -bench=Bench -run Bench -benchmem >> output.txt