Skip to content

Commit 9aaca95

Browse files
committed
perf(lesy-benchmark): update results
1 parent fb10302 commit 9aaca95

File tree

8 files changed

+77
-42
lines changed

8 files changed

+77
-42
lines changed

benchmark/benchmark.suite.js

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,43 @@ const { build: gluegun } = require("gluegun");
55
const lesy = require("@lesy/compiler");
66
const { commanderCode, gluegunCode, yargsCode, lesyCode } = require("./libs");
77

8+
const options = {
9+
// minSamples: 100
10+
};
11+
812
b.suite(
913
"Performance test",
14+
b.add(
15+
"lesy",
16+
async () => {
17+
await lesyCode(lesy);
18+
},
19+
options,
20+
),
1021

11-
b.add("commander", () => {
12-
commanderCode(commander);
13-
}),
14-
15-
b.add("yargs", () => {
16-
yargsCode(yargs);
17-
}),
22+
b.add(
23+
"commander",
24+
() => {
25+
commanderCode(commander);
26+
},
27+
options,
28+
),
1829

19-
b.add("glugun", async () => {
20-
await gluegunCode(gluegun);
21-
}),
30+
b.add(
31+
"yargs",
32+
() => {
33+
yargsCode(yargs);
34+
},
35+
options,
36+
),
2237

23-
b.add("lesy", async () => {
24-
await lesyCode(lesy);
25-
}),
38+
b.add(
39+
"glugun",
40+
async () => {
41+
await gluegunCode(gluegun);
42+
},
43+
options,
44+
),
2645

2746
b.cycle(),
2847
b.complete(),

benchmark/libs/commander.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
module.exports = program => {
2-
program.command("greet").action(function() {
3-
console.log("commander: Hello world");
4-
});
1+
module.exports = (program) => {
2+
program.command("greet").action(function () {});
53

64
program.parse(["./", "./", "greet"]);
75
};

benchmark/libs/gluegun.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
module.exports = async greet => {
1+
module.exports = async (greet) => {
22
const movieCLI = greet("greetings")
33
.command({
44
name: "greet",
5-
run: () => console.log("gluegun: hello world"),
5+
run: () => {},
66
})
77
.src(__dirname)
88
.exclude([

benchmark/libs/lesy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = async (lesy) =>
22
await lesy({
33
loadDefaultPlugins: false,
4-
commands: [{ name: "greet", run: () => console.log("lesy: hello world") }],
4+
commands: [{ name: "greet", run: () => {} }],
55
}).parse(["greet"]);

benchmark/libs/yargs.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
module.exports = yargs => {
1+
module.exports = (yargs) => {
22
yargs
33
.command(
44
"greet",
55
"greeting",
66
() => {},
7-
argv => {
8-
console.log("yargs: hello world");
9-
},
7+
(argv) => {},
108
)
119
.parse(["greet"]);
1210
};

benchmark/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"main": "benchmark.suite.js",
55
"scripts": {
66
"benchmark": "node ./benchmark.suite.js",
7+
"benchmarkWS": "node --max-old-space-size=10000 ./benchmark.suite.js",
78
"copy-to-docs": "cp results/perf.json ../docs/static/"
89
},
910
"private": true,

benchmark/results/perf.chart.html

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</head>
1717
<body>
1818
<div style="max-width: 800px;">
19-
<canvas id="chart1598153325351" width="16" height="9"></canvas>
19+
<canvas id="chart1600224616591" width="16" height="9"></canvas>
2020
</div>
2121
<script>
2222
const format = num => {
@@ -34,21 +34,28 @@
3434

3535
return chunked.map(chunk => chunk.join("")).join(" ");
3636
};
37-
const ctx1598153325351 = document
38-
.getElementById("chart1598153325351")
37+
const ctx1600224616591 = document
38+
.getElementById("chart1600224616591")
3939
.getContext("2d");
40-
const chart1598153325351 = new Chart(ctx1598153325351, {
40+
const chart1600224616591 = new Chart(ctx1600224616591, {
4141
type: "bar",
4242
data: {
43-
labels: ["commander", "lesy"],
43+
labels: ["lesy", "commander", "yargs", "glugun"],
4444
datasets: [
4545
{
46-
data: [40126, 18674],
46+
data: [195019, 239421, 8520, 261],
4747
backgroundColor: [
4848
"rgba(63, 142, 252, 0.8)",
49-
"rgba(116, 165, 127, 0.8)"
49+
"rgba(116, 165, 127, 0.8)",
50+
"rgba(158, 206, 154, 0.8)",
51+
"rgba(58, 175, 185, 0.8)"
52+
],
53+
borderColor: [
54+
"rgba(63, 142, 252, 1)",
55+
"rgba(116, 165, 127, 1)",
56+
"rgba(158, 206, 154, 1)",
57+
"rgba(58, 175, 185, 1)"
5058
],
51-
borderColor: ["rgba(63, 142, 252, 1)", "rgba(116, 165, 127, 1)"],
5259
borderWidth: 1
5360
}
5461
]

benchmark/results/perf.json

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,39 @@
11
{
22
"name": "Performance test",
3-
"date": "2020-08-23T03:28:45.351Z",
3+
"date": "2020-09-16T02:50:16.591Z",
44
"version": "1.0.0",
55
"results": [
6+
{
7+
"name": "lesy",
8+
"ops": 195019,
9+
"margin": 0.77,
10+
"percentSlower": 18.55
11+
},
612
{
713
"name": "commander",
8-
"ops": 40126,
9-
"margin": 39.33,
14+
"ops": 239421,
15+
"margin": 42.26,
1016
"percentSlower": 0
1117
},
1218
{
13-
"name": "lesy",
14-
"ops": 18674,
15-
"margin": 11.74,
16-
"percentSlower": 53.46
19+
"name": "yargs",
20+
"ops": 8520,
21+
"margin": 23.18,
22+
"percentSlower": 96.44
23+
},
24+
{
25+
"name": "glugun",
26+
"ops": 261,
27+
"margin": 23.46,
28+
"percentSlower": 99.89
1729
}
1830
],
1931
"fastest": {
2032
"name": "commander",
21-
"index": 0
33+
"index": 1
2234
},
2335
"slowest": {
24-
"name": "lesy",
25-
"index": 1
36+
"name": "glugun",
37+
"index": 3
2638
}
2739
}

0 commit comments

Comments
 (0)