Skip to content

Commit e1ceacf

Browse files
Merge branch 'main' into module-docs-parentURL
2 parents 243207a + ac9e594 commit e1ceacf

File tree

891 files changed

+8685
-8200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

891 files changed

+8685
-8200
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ release.
3636
</tr>
3737
<tr>
3838
<td valign="top">
39-
<b><a href="doc/changelogs/CHANGELOG_V21.md#21.3.0">21.3.0</a></b><br/>
39+
<b><a href="doc/changelogs/CHANGELOG_V21.md#21.4.0">21.4.0</a></b><br/>
40+
<a href="doc/changelogs/CHANGELOG_V21.md#21.3.0">21.3.0</a><br/>
4041
<a href="doc/changelogs/CHANGELOG_V21.md#21.2.0">21.2.0</a><br/>
4142
<a href="doc/changelogs/CHANGELOG_V21.md#21.1.0">21.1.0</a><br/>
4243
<a href="doc/changelogs/CHANGELOG_V21.md#21.0.0">21.0.0</a><br/>

benchmark/crypto/create-hash.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
3+
const common = require('../common.js');
4+
const { createHash } = require('crypto');
5+
const assert = require('assert');
6+
7+
const bench = common.createBenchmark(main, {
8+
n: [1e5],
9+
});
10+
11+
function main({ n }) {
12+
const array = [];
13+
for (let i = 0; i < n; ++i) {
14+
array.push(null);
15+
}
16+
bench.start();
17+
for (let i = 0; i < n; ++i) {
18+
array[i] = createHash('sha1');
19+
}
20+
bench.end(n);
21+
assert.strictEqual(typeof array[n - 1], 'object');
22+
}

benchmark/fs/bench-readvSync.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const fs = require('fs');
5+
const assert = require('assert');
6+
const tmpdir = require('../../test/common/tmpdir');
7+
tmpdir.refresh();
8+
9+
const exptectedBuff = Buffer.from('Benchmark Data');
10+
const expectedLength = exptectedBuff.length;
11+
12+
const bufferArr = [Buffer.alloc(expectedLength)];
13+
14+
const filename = tmpdir.resolve('readv_sync.txt');
15+
fs.writeFileSync(filename, exptectedBuff);
16+
17+
const bench = common.createBenchmark(main, {
18+
type: ['valid', 'invalid'],
19+
n: [1e5],
20+
});
21+
22+
function main({ n, type }) {
23+
let fd;
24+
let result;
25+
26+
switch (type) {
27+
case 'valid':
28+
fd = fs.openSync(filename, 'r');
29+
30+
bench.start();
31+
for (let i = 0; i < n; i++) {
32+
result = fs.readvSync(fd, bufferArr, 0);
33+
}
34+
35+
bench.end(n);
36+
assert.strictEqual(result, expectedLength);
37+
fs.closeSync(fd);
38+
break;
39+
case 'invalid': {
40+
fd = 1 << 30;
41+
let hasError = false;
42+
bench.start();
43+
for (let i = 0; i < n; i++) {
44+
try {
45+
result = fs.readvSync(fd, bufferArr, 0);
46+
} catch {
47+
hasError = true;
48+
}
49+
}
50+
51+
bench.end(n);
52+
assert(hasError);
53+
break;
54+
}
55+
default:
56+
throw new Error('Invalid type');
57+
}
58+
}

benchmark/util/format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const inputs = {
1818
};
1919

2020
const bench = common.createBenchmark(main, {
21-
n: [1e5],
21+
n: [1e6],
2222
type: Object.keys(inputs),
2323
});
2424

benchmark/util/inspect-array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
const util = require('util');
55

66
const bench = common.createBenchmark(main, {
7-
n: [5e2],
7+
n: [5e3],
88
len: [1e2, 1e5],
99
type: [
1010
'denseArray',

benchmark/util/normalize-encoding.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const inputs = [
2121

2222
const bench = common.createBenchmark(main, {
2323
input: inputs.concat(Object.keys(groupedInputs)),
24-
n: [1e5],
24+
n: [1e6],
2525
}, {
2626
flags: '--expose-internals',
2727
});

benchmark/util/text-decoder.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const bench = common.createBenchmark(main, {
66
encoding: ['utf-8', 'latin1', 'iso-8859-3'],
77
ignoreBOM: [0, 1],
88
fatal: [0, 1],
9-
len: [256, 1024 * 16, 1024 * 512],
10-
n: [1e2],
9+
len: [256, 1024 * 16, 1024 * 128],
10+
n: [1e3],
1111
type: ['SharedArrayBuffer', 'ArrayBuffer', 'Buffer'],
1212
});
1313

benchmark/util/type-check.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const bench = common.createBenchmark(main, {
2929
type: Object.keys(args),
3030
version: ['native', 'js'],
3131
argument: ['true', 'false-primitive', 'false-object'],
32-
n: [1e5],
32+
n: [1e6],
3333
}, {
3434
flags: ['--expose-internals', '--no-warnings'],
3535
});

0 commit comments

Comments
 (0)