Skip to content

Commit

Permalink
perf(lesy-benchmark): update results
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh-coder committed Sep 16, 2020
1 parent fb10302 commit 9aaca95
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 42 deletions.
45 changes: 32 additions & 13 deletions benchmark/benchmark.suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,43 @@ const { build: gluegun } = require("gluegun");
const lesy = require("@lesy/compiler");
const { commanderCode, gluegunCode, yargsCode, lesyCode } = require("./libs");

const options = {
// minSamples: 100
};

b.suite(
"Performance test",
b.add(
"lesy",
async () => {
await lesyCode(lesy);
},
options,
),

b.add("commander", () => {
commanderCode(commander);
}),

b.add("yargs", () => {
yargsCode(yargs);
}),
b.add(
"commander",
() => {
commanderCode(commander);
},
options,
),

b.add("glugun", async () => {
await gluegunCode(gluegun);
}),
b.add(
"yargs",
() => {
yargsCode(yargs);
},
options,
),

b.add("lesy", async () => {
await lesyCode(lesy);
}),
b.add(
"glugun",
async () => {
await gluegunCode(gluegun);
},
options,
),

b.cycle(),
b.complete(),
Expand Down
6 changes: 2 additions & 4 deletions benchmark/libs/commander.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module.exports = program => {
program.command("greet").action(function() {
console.log("commander: Hello world");
});
module.exports = (program) => {
program.command("greet").action(function () {});

program.parse(["./", "./", "greet"]);
};
4 changes: 2 additions & 2 deletions benchmark/libs/gluegun.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = async greet => {
module.exports = async (greet) => {
const movieCLI = greet("greetings")
.command({
name: "greet",
run: () => console.log("gluegun: hello world"),
run: () => {},
})
.src(__dirname)
.exclude([
Expand Down
2 changes: 1 addition & 1 deletion benchmark/libs/lesy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = async (lesy) =>
await lesy({
loadDefaultPlugins: false,
commands: [{ name: "greet", run: () => console.log("lesy: hello world") }],
commands: [{ name: "greet", run: () => {} }],
}).parse(["greet"]);
6 changes: 2 additions & 4 deletions benchmark/libs/yargs.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
module.exports = yargs => {
module.exports = (yargs) => {
yargs
.command(
"greet",
"greeting",
() => {},
argv => {
console.log("yargs: hello world");
},
(argv) => {},
)
.parse(["greet"]);
};
1 change: 1 addition & 0 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"main": "benchmark.suite.js",
"scripts": {
"benchmark": "node ./benchmark.suite.js",
"benchmarkWS": "node --max-old-space-size=10000 ./benchmark.suite.js",
"copy-to-docs": "cp results/perf.json ../docs/static/"
},
"private": true,
Expand Down
23 changes: 15 additions & 8 deletions benchmark/results/perf.chart.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</head>
<body>
<div style="max-width: 800px;">
<canvas id="chart1598153325351" width="16" height="9"></canvas>
<canvas id="chart1600224616591" width="16" height="9"></canvas>
</div>
<script>
const format = num => {
Expand All @@ -34,21 +34,28 @@

return chunked.map(chunk => chunk.join("")).join(" ");
};
const ctx1598153325351 = document
.getElementById("chart1598153325351")
const ctx1600224616591 = document
.getElementById("chart1600224616591")
.getContext("2d");
const chart1598153325351 = new Chart(ctx1598153325351, {
const chart1600224616591 = new Chart(ctx1600224616591, {
type: "bar",
data: {
labels: ["commander", "lesy"],
labels: ["lesy", "commander", "yargs", "glugun"],
datasets: [
{
data: [40126, 18674],
data: [195019, 239421, 8520, 261],
backgroundColor: [
"rgba(63, 142, 252, 0.8)",
"rgba(116, 165, 127, 0.8)"
"rgba(116, 165, 127, 0.8)",
"rgba(158, 206, 154, 0.8)",
"rgba(58, 175, 185, 0.8)"
],
borderColor: [
"rgba(63, 142, 252, 1)",
"rgba(116, 165, 127, 1)",
"rgba(158, 206, 154, 1)",
"rgba(58, 175, 185, 1)"
],
borderColor: ["rgba(63, 142, 252, 1)", "rgba(116, 165, 127, 1)"],
borderWidth: 1
}
]
Expand Down
32 changes: 22 additions & 10 deletions benchmark/results/perf.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
{
"name": "Performance test",
"date": "2020-08-23T03:28:45.351Z",
"date": "2020-09-16T02:50:16.591Z",
"version": "1.0.0",
"results": [
{
"name": "lesy",
"ops": 195019,
"margin": 0.77,
"percentSlower": 18.55
},
{
"name": "commander",
"ops": 40126,
"margin": 39.33,
"ops": 239421,
"margin": 42.26,
"percentSlower": 0
},
{
"name": "lesy",
"ops": 18674,
"margin": 11.74,
"percentSlower": 53.46
"name": "yargs",
"ops": 8520,
"margin": 23.18,
"percentSlower": 96.44
},
{
"name": "glugun",
"ops": 261,
"margin": 23.46,
"percentSlower": 99.89
}
],
"fastest": {
"name": "commander",
"index": 0
"index": 1
},
"slowest": {
"name": "lesy",
"index": 1
"name": "glugun",
"index": 3
}
}

0 comments on commit 9aaca95

Please sign in to comment.