mirror of
https://github.com/romdo/go-conventionalcommit.git
synced 2026-02-19 08:06:41 +00:00
add Benchmark (go) benchmark result for e8ca009440
This commit is contained in:
266
dev/bench/data.js
Normal file
266
dev/bench/data.js
Normal file
@@ -0,0 +1,266 @@
|
||||
window.BENCHMARK_DATA = {
|
||||
"lastUpdate": 1628539842067,
|
||||
"repoUrl": "https://github.com/romdo/go-conventionalcommit",
|
||||
"entries": {
|
||||
"Benchmark": [
|
||||
{
|
||||
"commit": {
|
||||
"author": {
|
||||
"email": "contact@jimeh.me",
|
||||
"name": "Jim Myhrberg",
|
||||
"username": "jimeh"
|
||||
},
|
||||
"committer": {
|
||||
"email": "noreply@github.com",
|
||||
"name": "GitHub",
|
||||
"username": "web-flow"
|
||||
},
|
||||
"distinct": true,
|
||||
"id": "e8ca0094405c69ca11e814cf4c3f6fa4e29fd964",
|
||||
"message": "Merge pull request #1 from romdo/add-rawmessage\n\nfeat(parser): implement RawMessage",
|
||||
"timestamp": "2021-08-09T21:06:35+01:00",
|
||||
"tree_id": "2be1c5766f33a3d9786adcc8f0e407f71ca17df2",
|
||||
"url": "https://github.com/romdo/go-conventionalcommit/commit/e8ca0094405c69ca11e814cf4c3f6fa4e29fd964"
|
||||
},
|
||||
"date": 1628539841336,
|
||||
"tool": "go",
|
||||
"benches": [
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__single_line",
|
||||
"value": 34.5,
|
||||
"unit": "ns/op",
|
||||
"extra": "33146340 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__single_line_with_trailing_LF",
|
||||
"value": 40.6,
|
||||
"unit": "ns/op",
|
||||
"extra": "29882890 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__single_line_with_trailing_CRLF",
|
||||
"value": 42,
|
||||
"unit": "ns/op",
|
||||
"extra": "29006472 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__single_line_with_trailing_CR",
|
||||
"value": 40.8,
|
||||
"unit": "ns/op",
|
||||
"extra": "29639756 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__multi_line_separated_by_LF",
|
||||
"value": 137,
|
||||
"unit": "ns/op",
|
||||
"extra": "8818696 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__multi_line_separated_by_CRLF",
|
||||
"value": 142,
|
||||
"unit": "ns/op",
|
||||
"extra": "8162557 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_Bytes__multi_line_separated_by_CR",
|
||||
"value": 136,
|
||||
"unit": "ns/op",
|
||||
"extra": "8745592 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__single_line",
|
||||
"value": 37.9,
|
||||
"unit": "ns/op",
|
||||
"extra": "30263858 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__single_line_with_trailing_LF",
|
||||
"value": 46.3,
|
||||
"unit": "ns/op",
|
||||
"extra": "26519558 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__single_line_with_trailing_CRLF",
|
||||
"value": 46.9,
|
||||
"unit": "ns/op",
|
||||
"extra": "26067218 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__single_line_with_trailing_CR",
|
||||
"value": 45.8,
|
||||
"unit": "ns/op",
|
||||
"extra": "26700357 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__multi_line_separated_by_LF",
|
||||
"value": 194,
|
||||
"unit": "ns/op",
|
||||
"extra": "6139024 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__multi_line_separated_by_CRLF",
|
||||
"value": 204,
|
||||
"unit": "ns/op",
|
||||
"extra": "5944452 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkLines_String__multi_line_separated_by_CR",
|
||||
"value": 198,
|
||||
"unit": "ns/op",
|
||||
"extra": "6105099 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__nil",
|
||||
"value": 42.4,
|
||||
"unit": "ns/op",
|
||||
"extra": "27482770 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__empty",
|
||||
"value": 43,
|
||||
"unit": "ns/op",
|
||||
"extra": "28105476 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__single_space",
|
||||
"value": 176,
|
||||
"unit": "ns/op",
|
||||
"extra": "6438363 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__subject_only",
|
||||
"value": 266,
|
||||
"unit": "ns/op",
|
||||
"extra": "4322313 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__subject_and_body",
|
||||
"value": 859,
|
||||
"unit": "ns/op",
|
||||
"extra": "1327281 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__subject_and_body_with_CRLF_line_breaks",
|
||||
"value": 864,
|
||||
"unit": "ns/op",
|
||||
"extra": "1362050 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__subject_and_body_with_CR_line_breaks",
|
||||
"value": 876,
|
||||
"unit": "ns/op",
|
||||
"extra": "1381249 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__separated_by_whitespace_line",
|
||||
"value": 881,
|
||||
"unit": "ns/op",
|
||||
"extra": "1381087 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkNewRawMessage__subject_and_long_body",
|
||||
"value": 5833,
|
||||
"unit": "ns/op",
|
||||
"extra": "208868 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__empty",
|
||||
"value": 8.47,
|
||||
"unit": "ns/op",
|
||||
"extra": "142406499 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__single_space",
|
||||
"value": 24.6,
|
||||
"unit": "ns/op",
|
||||
"extra": "48954320 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__subject_only",
|
||||
"value": 37.4,
|
||||
"unit": "ns/op",
|
||||
"extra": "29611442 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__subject_and_body",
|
||||
"value": 56.4,
|
||||
"unit": "ns/op",
|
||||
"extra": "21679516 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__subject_and_body_with_CRLF_line_breaks",
|
||||
"value": 60.6,
|
||||
"unit": "ns/op",
|
||||
"extra": "19804483 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__subject_and_body_with_CR_line_breaks",
|
||||
"value": 55.3,
|
||||
"unit": "ns/op",
|
||||
"extra": "21668710 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__separated_by_whitespace_line",
|
||||
"value": 57,
|
||||
"unit": "ns/op",
|
||||
"extra": "21257516 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_Bytes__subject_and_long_body",
|
||||
"value": 447,
|
||||
"unit": "ns/op",
|
||||
"extra": "2630110 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__empty",
|
||||
"value": 10.8,
|
||||
"unit": "ns/op",
|
||||
"extra": "100000000 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__single_space",
|
||||
"value": 27.2,
|
||||
"unit": "ns/op",
|
||||
"extra": "43455600 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__subject_only",
|
||||
"value": 42.4,
|
||||
"unit": "ns/op",
|
||||
"extra": "27122796 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__subject_and_body",
|
||||
"value": 88.1,
|
||||
"unit": "ns/op",
|
||||
"extra": "13643185 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__subject_and_body_with_CRLF_line_breaks",
|
||||
"value": 88.9,
|
||||
"unit": "ns/op",
|
||||
"extra": "13576803 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__subject_and_body_with_CR_line_breaks",
|
||||
"value": 87.8,
|
||||
"unit": "ns/op",
|
||||
"extra": "13678256 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__separated_by_whitespace_line",
|
||||
"value": 90.3,
|
||||
"unit": "ns/op",
|
||||
"extra": "12800388 times"
|
||||
},
|
||||
{
|
||||
"name": "BenchmarkRawMessage_String__subject_and_long_body",
|
||||
"value": 693,
|
||||
"unit": "ns/op",
|
||||
"extra": "1724236 times"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
275
dev/bench/index.html
Normal file
275
dev/bench/index.html
Normal file
@@ -0,0 +1,275 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes" />
|
||||
<style>
|
||||
html {
|
||||
font-family: BlinkMacSystemFont,-apple-system,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
background-color: #fff;
|
||||
font-size: 16px;
|
||||
}
|
||||
body {
|
||||
color: #4a4a4a;
|
||||
margin: 8px;
|
||||
font-size: 1em;
|
||||
font-weight: 400;
|
||||
}
|
||||
header {
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
main {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
a {
|
||||
color: #3273dc;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #000;
|
||||
}
|
||||
button {
|
||||
color: #fff;
|
||||
background-color: #3298dc;
|
||||
border-color: transparent;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
button:hover {
|
||||
background-color: #2793da;
|
||||
flex: none;
|
||||
}
|
||||
.spacer {
|
||||
flex: auto;
|
||||
}
|
||||
.small {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
footer {
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.header-label {
|
||||
margin-right: 4px;
|
||||
}
|
||||
.benchmark-set {
|
||||
margin: 8px 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.benchmark-title {
|
||||
font-size: 3rem;
|
||||
font-weight: 600;
|
||||
word-break: break-word;
|
||||
text-align: center;
|
||||
}
|
||||
.benchmark-graphs {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
}
|
||||
.benchmark-chart {
|
||||
max-width: 1000px;
|
||||
}
|
||||
</style>
|
||||
<title>Benchmarks</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header id="header">
|
||||
<div class="header-item">
|
||||
<strong class="header-label">Last Update:</strong>
|
||||
<span id="last-update"></span>
|
||||
</div>
|
||||
<div class="header-item">
|
||||
<strong class="header-label">Repository:</strong>
|
||||
<a id="repository-link" rel="noopener"></a>
|
||||
</div>
|
||||
</header>
|
||||
<main id="main"></main>
|
||||
<footer>
|
||||
<button id="dl-button">Download data as JSON</button>
|
||||
<div class="spacer"></div>
|
||||
<div class="small">Powered by <a rel="noopener" href="https://github.com/marketplace/actions/continuous-benchmark">github-action-benchmark</a></div>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.9.2/dist/Chart.min.js"></script>
|
||||
<script src="data.js"></script>
|
||||
<script id="main-script">
|
||||
'use strict';
|
||||
(function() {
|
||||
// Colors from https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
|
||||
const toolColors = {
|
||||
cargo: '#dea584',
|
||||
go: '#00add8',
|
||||
benchmarkjs: '#f1e05a',
|
||||
pytest: '#3572a5',
|
||||
googlecpp: '#f34b7d',
|
||||
catch2: '#f34b7d',
|
||||
_: '#333333'
|
||||
};
|
||||
|
||||
function init() {
|
||||
function collectBenchesPerTestCase(entries) {
|
||||
const map = new Map();
|
||||
for (const entry of entries) {
|
||||
const {commit, date, tool, benches} = entry;
|
||||
for (const bench of benches) {
|
||||
const result = { commit, date, tool, bench };
|
||||
const arr = map.get(bench.name);
|
||||
if (arr === undefined) {
|
||||
map.set(bench.name, [result]);
|
||||
} else {
|
||||
arr.push(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
const data = window.BENCHMARK_DATA;
|
||||
|
||||
// Render header
|
||||
document.getElementById('last-update').textContent = new Date(data.lastUpdate).toString();
|
||||
const repoLink = document.getElementById('repository-link');
|
||||
repoLink.href = data.repoUrl;
|
||||
repoLink.textContent = data.repoUrl;
|
||||
|
||||
// Render footer
|
||||
document.getElementById('dl-button').onclick = () => {
|
||||
const dataUrl = 'data:,' + JSON.stringify(data, null, 2);
|
||||
const a = document.createElement('a');
|
||||
a.href = dataUrl;
|
||||
a.download = 'benchmark_data.json';
|
||||
a.click();
|
||||
};
|
||||
|
||||
// Prepare data points for charts
|
||||
return Object.keys(data.entries).map(name => ({
|
||||
name,
|
||||
dataSet: collectBenchesPerTestCase(data.entries[name]),
|
||||
}));
|
||||
}
|
||||
|
||||
function renderAllChars(dataSets) {
|
||||
|
||||
function renderGraph(parent, name, dataset) {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.className = 'benchmark-chart';
|
||||
parent.appendChild(canvas);
|
||||
|
||||
const color = toolColors[dataset.length > 0 ? dataset[0].tool : '_'];
|
||||
const data = {
|
||||
labels: dataset.map(d => d.commit.id.slice(0, 7)),
|
||||
datasets: [
|
||||
{
|
||||
label: name,
|
||||
data: dataset.map(d => d.bench.value),
|
||||
borderColor: color,
|
||||
backgroundColor: color + '60', // Add alpha for #rrggbbaa
|
||||
}
|
||||
],
|
||||
};
|
||||
const options = {
|
||||
scales: {
|
||||
xAxes: [
|
||||
{
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: 'commit',
|
||||
},
|
||||
}
|
||||
],
|
||||
yAxes: [
|
||||
{
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: dataset.length > 0 ? dataset[0].bench.unit : '',
|
||||
},
|
||||
ticks: {
|
||||
beginAtZero: true,
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
tooltips: {
|
||||
callbacks: {
|
||||
afterTitle: items => {
|
||||
const {index} = items[0];
|
||||
const data = dataset[index];
|
||||
return '\n' + data.commit.message + '\n\n' + data.commit.timestamp + ' committed by @' + data.commit.committer.username + '\n';
|
||||
},
|
||||
label: item => {
|
||||
let label = item.value;
|
||||
const { range, unit } = dataset[item.index].bench;
|
||||
label += ' ' + unit;
|
||||
if (range) {
|
||||
label += ' (' + range + ')';
|
||||
}
|
||||
return label;
|
||||
},
|
||||
afterLabel: item => {
|
||||
const { extra } = dataset[item.index].bench;
|
||||
return extra ? '\n' + extra : '';
|
||||
}
|
||||
}
|
||||
},
|
||||
onClick: (_mouseEvent, activeElems) => {
|
||||
if (activeElems.length === 0) {
|
||||
return;
|
||||
}
|
||||
// XXX: Undocumented. How can we know the index?
|
||||
const index = activeElems[0]._index;
|
||||
const url = dataset[index].commit.url;
|
||||
window.open(url, '_blank');
|
||||
},
|
||||
};
|
||||
|
||||
new Chart(canvas, {
|
||||
type: 'line',
|
||||
data,
|
||||
options,
|
||||
});
|
||||
}
|
||||
|
||||
function renderBenchSet(name, benchSet, main) {
|
||||
const setElem = document.createElement('div');
|
||||
setElem.className = 'benchmark-set';
|
||||
main.appendChild(setElem);
|
||||
|
||||
const nameElem = document.createElement('h1');
|
||||
nameElem.className = 'benchmark-title';
|
||||
nameElem.textContent = name;
|
||||
setElem.appendChild(nameElem);
|
||||
|
||||
const graphsElem = document.createElement('div');
|
||||
graphsElem.className = 'benchmark-graphs';
|
||||
setElem.appendChild(graphsElem);
|
||||
|
||||
for (const [benchName, benches] of benchSet.entries()) {
|
||||
renderGraph(graphsElem, benchName, benches)
|
||||
}
|
||||
}
|
||||
|
||||
const main = document.getElementById('main');
|
||||
for (const {name, dataSet} of dataSets) {
|
||||
renderBenchSet(name, dataSet, main);
|
||||
}
|
||||
}
|
||||
|
||||
renderAllChars(init()); // Start
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user