Skip to content

Commit

Permalink
summary without expandable details
Browse files Browse the repository at this point in the history
  • Loading branch information
ktrz committed Jan 26, 2024
1 parent 3941544 commit 1a40d3d
Showing 1 changed file with 5 additions and 64 deletions.
69 changes: 5 additions & 64 deletions src/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ function commentFooter(): string {
return `This comment was automatically generated by [workflow](${actionUrl}) using [github-action-benchmark](https://github.com/marketplace/actions/continuous-benchmark).`;
}

function buildComment(benchName: string, curSuite: Benchmark, prevSuite: Benchmark): string {
function buildComment(benchName: string, curSuite: Benchmark, prevSuite: Benchmark, expandableDetails = true): string {
const lines = [
`# ${benchName}`,
'',
'<details>',
expandableDetails ? '<details>' : '',
'',
`| Benchmark suite | Current: ${curSuite.commit.id} | Previous: ${prevSuite.commit.id} | Ratio |`,
'|-|-|-|-|',
Expand All @@ -188,7 +188,7 @@ function buildComment(benchName: string, curSuite: Benchmark, prevSuite: Benchma
}

// Footer
lines.push('', '</details>', '', commentFooter());
lines.push('', expandableDetails ? '</details>' : '', '', commentFooter());

return lines.join('\n');
}
Expand Down Expand Up @@ -557,71 +557,12 @@ async function handleSummary(benchName: string, currBench: Benchmark, prevBench:
return;
}

// const headers = [
// {
// data: 'Benchmark Suite',
// header: true,
// },
// {
// data: `Current: "${currBench.commit.id}"`,
// header: true,
// },
// {
// data: `Previous: "${prevBench.commit.id}"`,
// header: true,
// },
// {
// data: 'Ratio',
// header: true,
// },
// ];
// const rows: SummaryTableRow[] = currBench.benches.map((bench) => {
// const previousBench = prevBench.benches.find((pb) => pb.name === bench.name);
//
// if (previousBench) {
// const ratio = biggerIsBetter(config.tool)
// ? previousBench.value / bench.value
// : bench.value / previousBench.value;
//
// return [
// {
// data: bench.name,
// },
// {
// data: strVal(bench),
// },
// {
// data: strVal(previousBench),
// },
// {
// data: floatStr(ratio),
// },
// ];
// }
//
// return [
// {
// data: bench.name,
// },
// {
// data: strVal(bench),
// },
// {
// data: '-',
// },
// {
// data: '-',
// },
// ];
// });

const body = buildComment(benchName, currBench, prevBench);
const body = buildComment(benchName, currBench, prevBench, false);

const summary = core.summary.addHeading(`Benchmarks: ${benchName}`).addRaw(body);

core.debug('Writing a summary about benchmark comparison');

core.debug('Writing :\n' + summary.stringify());
core.debug(summary.stringify());

await summary.write();
}

3 comments on commit 1a40d3d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rust Benchmark

Benchmark suite Current: 1a40d3d Previous: 6fc0096 Ratio
bench_fib_10 158 ns/iter (± 1)
bench_fib_20 19963 ns/iter (± 246)

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Benchmark

Benchmark suite Current: 1a40d3d Previous: 6fc0096 Ratio
BenchmarkFib10 310.6 ns/op 310.9 ns/op 1.00
BenchmarkFib20 40236 ns/op 39671 ns/op 1.01
BenchmarkFib20WithAuxMetric - ns/op 40412 ns/op 40385 ns/op 1.00
BenchmarkFib20WithAuxMetric - auxMetricUnits 4 auxMetricUnits 4 auxMetricUnits 1

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark.js Benchmark

Benchmark suite Current: 1a40d3d Previous: 6fc0096 Ratio
fib(10) 1654628 ops/sec (±0.39%) 1649609 ops/sec (±0.75%) 1.00
fib(20) 13331 ops/sec (±0.65%) 13398 ops/sec (±0.23%) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.