We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5d4da2 commit 3698fc1Copy full SHA for 3698fc1
README.md
@@ -47,7 +47,7 @@ $ bench-it ./node
47
To a pretty terminal output, run `index.js`
48
49
```console
50
-$ node index.js
+$ node --allow-natives-syntax index.js
51
cpu: 13th Gen Intel(R) Core(TM) i5-13600K (20 cores)
52
node: v20.13.1 (/home/hzk/.nvm/versions/node/v20.13.1/bin/node)
53
os: Linux 5.15.133.1-microsoft-standard-WSL2 x64
bench-it.js
@@ -13,7 +13,7 @@ if (process.argv.length < 3) {
13
const BINARY = process.argv[2];
14
15
if (process.argv[3] === "baseline") {
16
- const result = execSync(`${BINARY} ${NODEJS_PACKAGE_BENCHMARK_PATH}/index.js`, {
+ const result = execSync(`${BINARY} --allow-natives-syntax ${NODEJS_PACKAGE_BENCHMARK_PATH}/index.js`, {
17
env: { TTY: true },
18
}).toString();
19
fs.writeFileSync('baseline.out', `${result}`);
@@ -34,7 +34,7 @@ try {
34
diffCmd = "diff";
35
}
36
37
-const currentResult = execSync(`${BINARY} ${NODEJS_PACKAGE_BENCHMARK_PATH}/index.js`, {
+const currentResult = execSync(`${BINARY} --allow-natives-syntax ${NODEJS_PACKAGE_BENCHMARK_PATH}/index.js`, {
38
39
40
fs.writeFileSync('current.out', currentResult);
index.js
100644
100755
@@ -1,4 +1,4 @@
1
-#!/usr/bin/env node
+#!/usr/bin/env node --allow-natives-syntax
2
3
const fs = require('node:fs/promises');
4
const path = require('node:path');
package.json
@@ -30,6 +30,7 @@
30
"@types/lodash": "4.17.3",
31
"@types/underscore": "1.11.15",
32
"autocannon": "7.15.0",
33
+ "bench-node": "0.1.0",
"dotenv": "16.4.5",
"fastify": "4.26.1",
"lodash": "4.17.21",
src/babel-benchmark.js
@@ -1,5 +1,6 @@
const fs = require('node:fs');
+const assert = require('node:assert');
const Babel = require('@babel/standalone');
5
6
const payloads = [
@@ -16,6 +17,7 @@ module.exports = {
let v = undefined;
for (const p of payloads) {
v = Babel.transform(p, { code: true, ast: true }).code;
20
+ assert.ok(v)
21
22
return v;
23
},
@@ -25,7 +27,8 @@ module.exports = {
25
27
fn: () => {
26
28
29
- v = Babel.transform(p, { code: false }).code;
+ v = Babel.transform(p, { code: false });
+ assert.ok(v);
src/dotenv-benchmark.js
@@ -14,5 +14,5 @@ module.exports = {
],
- benchmarker: 'tinybench',
+ benchmarker: 'bench-node',
};
src/lodash-benchmark.js
@@ -1,3 +1,4 @@
const lodash = require('lodash');
module.exports = {
@@ -7,19 +8,19 @@ module.exports = {
7
8
{
9
name: '.chunk',
10
- lodash.chunk(['a', 'b', 'c', 'd'], 2);
11
+ assert.ok(lodash.chunk(['a', 'b', 'c', 'd'], 2));
12
name: '.groupBy',
- lodash.groupBy([6.1, 4.2, 6.3], Math.floor);
+ assert.ok(lodash.groupBy([6.1, 4.2, 6.3], Math.floor));
name: '.includes',
- lodash.includes({ 'a': 1, 'b': 2 }, 1);
+ assert.ok(lodash.includes({ 'a': 1, 'b': 2 }, 1));
24
@@ -31,9 +32,9 @@ module.exports = {
{ 'user': 'fred', 'age': 40 },
{ 'user': 'barney', 'age': 36 }
];
- lodash.orderBy(users, ['user', 'age'], ['asc', 'desc']);
+ assert.ok(lodash.orderBy(users, ['user', 'age'], ['asc', 'desc']));
src/moment-benchmark.js
const moment = require('moment');
@@ -7,27 +8,27 @@ module.exports = {
name: 'format (full)',
- return moment().format('MMMM Do YYYY, h:mm:ss a');
+ assert.ok(moment().format('MMMM Do YYYY, h:mm:ss a'));
name: 'format',
- return moment().format();
+ assert.ok(moment().format());
name: 'fromNow (YYYYMMDD)',
- return moment('20111031', 'YYYYMMDD').fromNow();
+ assert.ok(moment('20111031', 'YYYYMMDD').fromNow());
name: 'subtract (10)',
- return moment().subtract(10, 'days').calendar();
+ assert.ok(moment().subtract(10, 'days').calendar());
src/pino-benchmark.js
src/prettier-benchmark.js
const prettier = require('prettier');
@@ -15,7 +16,8 @@ module.exports = {
- v= prettier.format(p, { parser: 'babel' });
+ v = prettier.format(p, { parser: 'babel' });
@@ -29,6 +31,7 @@ module.exports = {
p,
{ singleQuote: true, useTabs: true, parser: 'babel' },
);
@@ -42,6 +45,7 @@ module.exports = {
42
45
43
46
{ semi: false, parser: 'babel' }
44
0 commit comments