Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
.gitignore
README.md
bench.js
index.js
package.json

README.md

JavaScript example for benchmarking with benchmark.js

This directory shows how to use github-action-benchmark with benchmark.js.

Run benchmarks

Official documentation for usage of benchmark.js:

https://benchmarkjs.com/

Prepare script bench.js as follows:

e.g.

const Benchmark = require('benchmark');
const suite = new Benchmark.Suite();

suite
    .add('some test case', () => {
        // ...
    })
    .on('cycle', event => {
        // Output benchmark result by converting benchmark result to string
        console.log(String(event.target));
    })
    .run();

Ensure the output includes string values converted from benchmark results. This action extracts measured values fron the output.

Run the script in workflow:

e.g.

- name: Run benchmark
  run: node bench.js | tee output.txt

Process benchmark results

Store the benchmark results with step using the action. Please set benchmarkjs to tool input.

- name: Store benchmark result
  uses: rhysd/github-action-benchmark@v1
  with:
    tool: 'benchmarkjs'
    output-file-path: output.txt

Please read 'How to use' section for common usage.

You can’t perform that action at this time.