Skip to content

Commit

Permalink
chore(benchmark): update benchmark chart config
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Apr 14, 2024
1 parent 836b258 commit 51114fd
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions test/benchmark/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const data = Object.entries(result).sort(
const name = path.basename(__filename).replace('.ts', '');
const chart = new QuickChart();
chart.setConfig({
type: 'bar',
type: 'horizontalBar',
data: {
labels: data.map(([name]) => name),
datasets: [
{
label: 'All benchmark items',
backgroundColor: 'rgba(255, 99, 132, 0.5)',
borderColor: 'rgb(255, 99, 132)',
backgroundColor: 'rgba(54, 162, 235, 0.5)',
borderColor: 'rgb(54, 162, 235)',
borderWidth: 1,
data: data.map(([, { avg }]) => avg.toFixed(1)),
},
Expand All @@ -32,20 +32,43 @@ chart.setConfig({
options: {
title: {
display: true,
text: `
All benchmark results by average multiplier
`,
text: 'Mutative vs Immer - All benchmark results by average multiplier',
},
plugins: {
datalabels: {
anchor: 'center',
align: 'center',
anchor: 'right',
align: 'right',
color: '#666',
font: {
weight: 'normal',
},
},
},
scales: {
xAxes: [
{
display: true,
scaleLabel: {
display: true,
labelString: 'Multiplier',
},
},
],
yAxes: [
{
type: 'category',
position: 'left',
display: true,
scaleLabel: {
display: true,
labelString: 'Benchmark Type',
},
ticks: {
reverse: true,
},
},
],
},
},
});

Expand Down
Binary file modified test/benchmark/results/all.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 51114fd

Please sign in to comment.