GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — benchmark: fix configuation parameters · nodejs/node@c189eec

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • benchmark
    • assert
      • deepequal-prims-and-objs-big-array.js
      • deepequal-prims-and-objs-big-loop.js
    • buffers
      • buffer-read.js
      • buffer-tostring.js
      • buffer-write.js
    • common.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/assert/deepequal-prims-and-objs-big-array.js‎

Copy file name to clipboardExpand all lines: benchmark/assert/deepequal-prims-and-objs-big-array.js
+14-11Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
'use strict';
22
var common = require('../common.js');
33
var assert = require('assert');
4+
5+
const primValues = {
6+
'null': null,
7+
'undefined': undefined,
8+
'string': 'a',
9+
'number': 1,
10+
'boolean': true,
11+
'object': { 0: 'a' },
12+
'array': [1, 2, 3],
13+
'new-array': new Array([1, 2, 3])
14+
};
15+
416
var bench = common.createBenchmark(main, {
5-
prim: [
6-
null,
7-
undefined,
8-
'a',
9-
1,
10-
true,
11-
{0: 'a'},
12-
[1, 2, 3],
13-
new Array([1, 2, 3])
14-
],
17+
prim: Object.keys(primValues),
1518
n: [25]
1619
});
1720

1821
function main(conf) {
19-
var prim = conf.prim;
22+
var prim = primValues[conf.prim];
2023
var n = +conf.n;
2124
var primArray;
2225
var primArrayCompare;
Collapse file

‎benchmark/assert/deepequal-prims-and-objs-big-loop.js‎

Copy file name to clipboardExpand all lines: benchmark/assert/deepequal-prims-and-objs-big-loop.js
+14-11Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
'use strict';
22
var common = require('../common.js');
33
var assert = require('assert');
4+
5+
const primValues = {
6+
'null': null,
7+
'undefined': undefined,
8+
'string': 'a',
9+
'number': 1,
10+
'boolean': true,
11+
'object': { 0: 'a' },
12+
'array': [1, 2, 3],
13+
'new-array': new Array([1, 2, 3])
14+
};
15+
416
var bench = common.createBenchmark(main, {
5-
prim: [
6-
null,
7-
undefined,
8-
'a',
9-
1,
10-
true,
11-
{0: 'a'},
12-
[1, 2, 3],
13-
new Array([1, 2, 3])
14-
],
17+
prim: Object.keys(primValues),
1518
n: [1e5]
1619
});
1720

1821
function main(conf) {
19-
var prim = conf.prim;
22+
var prim = primValues[conf.prim];
2023
var n = +conf.n;
2124
var x;
2225

Collapse file

‎benchmark/buffers/buffer-read.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
var common = require('../common.js');
33

44
var bench = common.createBenchmark(main, {
5-
noAssert: [false, true],
5+
noAssert: ['false', 'true'],
66
buffer: ['fast', 'slow'],
77
type: ['UInt8', 'UInt16LE', 'UInt16BE',
88
'UInt32LE', 'UInt32BE',
Collapse file

‎benchmark/buffers/buffer-tostring.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-tostring.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
const common = require('../common.js');
44

55
const bench = common.createBenchmark(main, {
6-
arg: [true, false],
6+
arg: ['true', 'false'],
77
len: [0, 1, 64, 1024],
88
n: [1e7]
99
});
1010

1111
function main(conf) {
12-
const arg = conf.arg;
12+
const arg = conf.arg === 'true';
1313
const len = conf.len | 0;
1414
const n = conf.n | 0;
1515
const buf = Buffer(len).fill(42);
Collapse file

‎benchmark/buffers/buffer-write.js‎

Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-write.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
var common = require('../common.js');
33
var bench = common.createBenchmark(main, {
4-
noAssert: [false, true],
4+
noAssert: ['false', 'true'],
55
buffer: ['fast', 'slow'],
66
type: ['UInt8', 'UInt16LE', 'UInt16BE',
77
'UInt32LE', 'UInt32BE',
Collapse file

‎benchmark/common.js‎

Copy file name to clipboardExpand all lines: benchmark/common.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ Benchmark.prototype._run = function() {
152152
var j = 0;
153153
set.forEach(function(s) {
154154
vals.forEach(function(val) {
155+
if (typeof val !== 'number' && typeof val !== 'string') {
156+
throw new TypeError(`configuration "${key}" had type ${typeof val}`);
157+
}
158+
155159
newSet[j++] = s.concat(key + '=' + val);
156160
});
157161
});

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.