command module
v0.3.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2019 License: MIT Imports: 9 Imported by: 0


📉 gobenchdata

Build Status View Action GoDoc Demo

a tool for inspecting go test -bench data, and a GitHub Action for continuous benchmarking.


GitHub Action

A GitHub Action for uploading Go benchmark data to gh-pages using gobenchdata.


For example, in main.workflow:

workflow "Benchmark" {
  on = "push"
  resolves = ["gobenchdata to gh-pages"]

action "filter" {
  uses = "actions/bin/filter@master"
  args = "branch master"

action "gobenchdata to gh-pages" {
  uses = "bobheadxi/gobenchdata@master"
  needs = ["filter"]
  secrets = ["GITHUB_TOKEN"]
  env = {
    PRUNE = "20"

Learn more about GitHub Actions in the official documentation.

Variable Default Purpose
GITHUB_TOKEN set by GitHub token to provide access to repository
GITHUB_ACTOR set by GitHub the user to make commits as
GIT_COMMIT_MESSAGE "add new benchmark run" the commit message for the benchmark update
GO_BENCHMARKS . benchmarks to run (argument for -bench)
GO_BENCHMARK_FLAGS additional flags for go test
GO_BENCHMARK_PKGS ./... packages to test (argument for go test)
FINAL_OUTPUT benchmarks.json destination path of benchmark data
PRUNE 0 number of past runs to keep (0 keeps everything)

The gobenchdata GitHub action eventually generates a JSON file with past benchmarks. You can visualize these continuous benchmarks by creating a web app that reads from the JSON benchmarks file, or by using gobenchdata-web:

go get -u go.bobheadxi.dev/gobenchdata/x/gobenchdata-web
git checkout gh-pages
gobenchdata-web --title "my benchmarks" # generates a web app in your working directory

You test the web app locally using a tool like serve:

serve .

This feature is a work in progress. An example site published by this repository is available at gobenchdata.bobheaxi.dev.

gobenchdata CLI

gobenchdata, which the GitHub Action leverages to manage benchmark data, is also available as a CLI:

go get -u go.bobheadxi.dev/gobenchdata
gobenchdata help

Usage documentation can be found in the godocs.

Development and Contributions

Please report bugs and requests in the repository issues!

See CONTRIBUTING.md for more detailed development documentation.



Gobenchdata is a tool for inspecting golang benchmark outputs. To install it, you must have Go installed:

go get -u go.bobheadxi.dev/gobenchdata
gobenchdata help

Then pipe your benchmark into the tool:

go test -bench . -benchmem ./... | gobenchdata --json bench.json

You can create a sort of database of benchmarks by appending new benchmarks to an existing file:

go test -benchtime 10000x -bench . -benchmem ./... | gobenchdata --json benchmarks.json --append

You can also merge results:

gobenchdata merge file1.json file2.json file3.json


Path Synopsis
Gobenchdata-web is a utility for generating a website template to visualize your continuous benchmark.
Gobenchdata-web is a utility for generating a website template to visualize your continuous benchmark.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL