Skip to content

Commit

Permalink
Fix/go tabled benchmarks (#32)
Browse files Browse the repository at this point in the history
* Tabled benchmark support added.
* Test cases added for tabled benchmarks.
  • Loading branch information
kaancfidan authored Nov 20, 2021
1 parent 80bf811 commit 5d6c8c4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ function extractGoResult(output: string): BenchmarkResult[] {
// Example:
// BenchmarkFib20-8 30000 41653 ns/op
// BenchmarkDoWithConfigurer1-8 30000000 42.3 ns/op
const reExtract = /^(Benchmark\w+)(-\d+)?\s+(\d+)\s+([0-9.]+)\s+(.+)$/;
const reExtract = /^(Benchmark\w+(?:\/?[\w()$%^&*-]*?)*?)(-\d+)?\s+(\d+)\s+([0-9.]+)\s+(.+)$/;

for (const line of lines) {
const m = line.match(reExtract);
Expand Down
7 changes: 5 additions & 2 deletions test/data/extract/go_output.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
goos: darwin
goarch: amd64
BenchmarkFib10-8 5000000 325 ns/op
BenchmarkFib20 30000 40537.123 ns/op
BenchmarkFib10-8 5000000 325 ns/op
BenchmarkFib20 30000 40537.123 ns/op
BenchmarkFib/my_tabled_benchmark_-_10-8 5000000 325 ns/op
BenchmarkFib/my_tabled_benchmark_-_20 30000 40537.123 ns/op
BenchmarkFib/my/tabled/benchmark_-_20 30001 40537.456 ns/op
PASS
ok _/Users/rhayasd/Develop/github.com/benchmark-action/github-action-benchmark/examples/go 3.614s
18 changes: 18 additions & 0 deletions test/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ describe('extractResult()', function() {
value: 40537.123,
extra: '30000 times',
},
{
name: 'BenchmarkFib/my_tabled_benchmark_-_10',
unit: 'ns/op',
value: 325,
extra: '5000000 times\n8 procs',
},
{
name: 'BenchmarkFib/my_tabled_benchmark_-_20',
unit: 'ns/op',
value: 40537.123,
extra: '30000 times',
},
{
name: 'BenchmarkFib/my/tabled/benchmark_-_20',
unit: 'ns/op',
value: 40537.456,
extra: '30001 times',
},
],
},
{
Expand Down

0 comments on commit 5d6c8c4

Please sign in to comment.