-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
77 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
benchmark | base4f8f259 | targeta6b76f4 | trend | ||
--- | --- | --- | --- | ||
simple-item.benchmark:create_and_render | 32.60 (± 1.42 ms) | 32.86 (± 1.42 ms) | 👌 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,45 @@ | ||
function template({ targetCommit, baseCommit }) { | ||
return `## Benchmark comparison | ||
Base commit: \`${targetCommit}\` | Target commit: \`${baseCommit}\` | ||
import json2md from "json2md"; | ||
|
||
WIP`; | ||
function template({ targetCommit, baseCommit, table }) { | ||
return json2md([ | ||
{ h2 : 'Benchmark comparison '}, | ||
{ p : `Base commit: \`${targetCommit}\` | Target commit: \`${baseCommit}\`` }, | ||
table | ||
]); | ||
} | ||
|
||
function generateRows(stats, name = '') { | ||
return stats.comparison.map((node) => { | ||
if (node.comparison) { | ||
return generateRows(node, `${node.benchmarkName || node.name}:`).reduce((a, b) => a.concat(b)); | ||
} | ||
|
||
const durationMetric = node.metrics.duration; | ||
const { baseStats, targetStats, samplesComparison } = durationMetric; | ||
|
||
return [ | ||
name + node.name, | ||
`${baseStats.median.toFixed(2)} (± ${targetStats.medianAbsoluteDeviation.toFixed(2)} ms)`, | ||
`${targetStats.median.toFixed(2)} (± ${targetStats.medianAbsoluteDeviation.toFixed(2)} ms)`, | ||
samplesComparison === 0 ? '👌' : samplesComparison === 1 ? '👎' : '👍' | ||
]; | ||
}); | ||
} | ||
|
||
function generateTable(baseCommit, targetCommit, stats) { | ||
return { | ||
table: { | ||
headers: ['benchmark', `base(\`${baseCommit}\`)`, `target(\`${targetCommit}\`)`, 'trend'], | ||
rows: generateRows(stats) | ||
} | ||
}; | ||
} | ||
|
||
export function generateComparisonComment(baseCommit, targetCommit, stats) { | ||
return template({ baseCommit, targetCommit }); | ||
const table = generateTable(baseCommit, targetCommit, stats); | ||
return template({ | ||
baseCommit, | ||
targetCommit, | ||
table | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters