GeezerVison is showing github.com — benchmark: reformat code for clarity · ide/node@566a151
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: benchmark/_http-benchmarkers.js +14-6Lines changed: 14 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,8 +15,13 @@ function AutocannonBenchmarker() { | 15 | 15 | } | 16 | 16 |
| 17 | 17 | AutocannonBenchmarker.prototype.create = function(options) { | 18 | | - const args = ['-d', options.duration, '-c', options.connections, '-j', '-n', | 19 | | - `http://127.0.0.1:${options.port}${options.path}` ]; | | 18 | + const args = [ | | 19 | + '-d', options.duration, | | 20 | + '-c', options.connections, | | 21 | + '-j', | | 22 | + '-n', | | 23 | + `http://127.0.0.1:${options.port}${options.path}` | | 24 | + ]; | 20 | 25 | const child = child_process.spawn(this.autocannon_exe, args); | 21 | 26 | return child; | 22 | 27 | }; | @@ -43,8 +48,12 @@ function WrkBenchmarker() { | 43 | 48 | } | 44 | 49 |
| 45 | 50 | WrkBenchmarker.prototype.create = function(options) { | 46 | | - const args = ['-d', options.duration, '-c', options.connections, '-t', 8, | 47 | | - `http://127.0.0.1:${options.port}${options.path}` ]; | | 51 | + const args = [ | | 52 | + '-d', options.duration, | | 53 | + '-c', options.connections, | | 54 | + '-t', 8, | | 55 | + `http://127.0.0.1:${options.port}${options.path}` | | 56 | + ]; | 48 | 57 | const child = child_process.spawn('wrk', args); | 49 | 58 | return child; | 50 | 59 | }; | @@ -59,8 +68,7 @@ WrkBenchmarker.prototype.processResults = function(output) { | 59 | 68 | } | 60 | 69 | }; | 61 | 70 |
| 62 | | -const http_benchmarkers = [ new WrkBenchmarker(), | 63 | | - new AutocannonBenchmarker() ]; | | 71 | +const http_benchmarkers = [new WrkBenchmarker(), new AutocannonBenchmarker()]; | 64 | 72 |
| 65 | 73 | const benchmarkers = {}; | 66 | 74 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/arrays/var-int.js +15-3Lines changed: 15 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | var common = require('../common.js'); | | 3 | + | | 4 | +var types = [ | | 5 | + 'Array', | | 6 | + 'Buffer', | | 7 | + 'Int8Array', | | 8 | + 'Uint8Array', | | 9 | + 'Int16Array', | | 10 | + 'Uint16Array', | | 11 | + 'Int32Array', | | 12 | + 'Uint32Array', | | 13 | + 'Float32Array', | | 14 | + 'Float64Array' | | 15 | +]; | | 16 | + | 3 | 17 | var bench = common.createBenchmark(main, { | 4 | | - type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array', | 5 | | - 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', | 6 | | - 'Float64Array'], | | 18 | + type: types, | 7 | 19 | n: [25] | 8 | 20 | }); | 9 | 21 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/arrays/zero-float.js +15-3Lines changed: 15 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | var common = require('../common.js'); | | 3 | + | | 4 | +var types = [ | | 5 | + 'Array', | | 6 | + 'Buffer', | | 7 | + 'Int8Array', | | 8 | + 'Uint8Array', | | 9 | + 'Int16Array', | | 10 | + 'Uint16Array', | | 11 | + 'Int32Array', | | 12 | + 'Uint32Array', | | 13 | + 'Float32Array', | | 14 | + 'Float64Array' | | 15 | +]; | | 16 | + | 3 | 17 | var bench = common.createBenchmark(main, { | 4 | | - type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array', | 5 | | - 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', | 6 | | - 'Float64Array'], | | 18 | + type: types, | 7 | 19 | n: [25] | 8 | 20 | }); | 9 | 21 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/arrays/zero-int.js +15-3Lines changed: 15 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | var common = require('../common.js'); | | 3 | + | | 4 | +var types = [ | | 5 | + 'Array', | | 6 | + 'Buffer', | | 7 | + 'Int8Array', | | 8 | + 'Uint8Array', | | 9 | + 'Int16Array', | | 10 | + 'Uint16Array', | | 11 | + 'Int32Array', | | 12 | + 'Uint32Array', | | 13 | + 'Float32Array', | | 14 | + 'Float64Array' | | 15 | +]; | | 16 | + | 3 | 17 | var bench = common.createBenchmark(main, { | 4 | | - type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array', | 5 | | - 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', | 6 | | - 'Float64Array'], | | 18 | + type: types, | 7 | 19 | n: [25] | 8 | 20 | }); | 9 | 21 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-base64-decode.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {}); | 7 | 7 | function main(conf) { | 8 | 8 | const s = 'abcd'.repeat(8 << 20); | 9 | 9 | s.match(/./); // Flatten string. | 10 | | - assert.equal(s.length % 4, 0); | | 10 | + assert.strictEqual(s.length % 4, 0); | 11 | 11 | const b = Buffer.allocUnsafe(s.length / 4 * 3); | 12 | 12 | b.write(s, 0, s.length, 'base64'); | 13 | 13 | bench.start(); | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-indexof.js +19-5Lines changed: 19 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -3,12 +3,26 @@ var common = require('../common.js'); | 3 | 3 | var fs = require('fs'); | 4 | 4 | const path = require('path'); | 5 | 5 |
| | 6 | +const searchStrings = [ | | 7 | + '@', | | 8 | + 'SQ', | | 9 | + '10x', | | 10 | + '--l', | | 11 | + 'Alice', | | 12 | + 'Gryphon', | | 13 | + 'Panther', | | 14 | + 'Ou est ma chatte?', | | 15 | + 'found it very', | | 16 | + 'among mad people', | | 17 | + 'neighbouring pool', | | 18 | + 'Soo--oop', | | 19 | + 'aaaaaaaaaaaaaaaaa', | | 20 | + 'venture to go near the house till she had brought herself down to', | | 21 | + '</i> to the Caterpillar' | | 22 | +]; | | 23 | + | 6 | 24 | var bench = common.createBenchmark(main, { | 7 | | - search: ['@', 'SQ', '10x', '--l', 'Alice', 'Gryphon', 'Panther', | 8 | | - 'Ou est ma chatte?', 'found it very', 'among mad people', | 9 | | - 'neighbouring pool', 'Soo--oop', 'aaaaaaaaaaaaaaaaa', | 10 | | - 'venture to go near the house till she had brought herself down to', | 11 | | - '</i> to the Caterpillar'], | | 25 | + search: searchStrings, | 12 | 26 | encoding: ['undefined', 'utf8', 'ucs2', 'binary'], | 13 | 27 | type: ['buffer', 'string'], | 14 | 28 | iter: [1] | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-read.js +18-6Lines changed: 18 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | var common = require('../common.js'); | 3 | 3 |
| | 4 | +var types = [ | | 5 | + 'UInt8', | | 6 | + 'UInt16LE', | | 7 | + 'UInt16BE', | | 8 | + 'UInt32LE', | | 9 | + 'UInt32BE', | | 10 | + 'Int8', | | 11 | + 'Int16LE', | | 12 | + 'Int16BE', | | 13 | + 'Int32LE', | | 14 | + 'Int32BE', | | 15 | + 'FloatLE', | | 16 | + 'FloatBE', | | 17 | + 'DoubleLE', | | 18 | + 'DoubleBE' | | 19 | +]; | | 20 | + | 4 | 21 | var bench = common.createBenchmark(main, { | 5 | 22 | noAssert: ['false', 'true'], | 6 | 23 | buffer: ['fast', 'slow'], | 7 | | - type: ['UInt8', 'UInt16LE', 'UInt16BE', | 8 | | - 'UInt32LE', 'UInt32BE', | 9 | | - 'Int8', 'Int16LE', 'Int16BE', | 10 | | - 'Int32LE', 'Int32BE', | 11 | | - 'FloatLE', 'FloatBE', | 12 | | - 'DoubleLE', 'DoubleBE'], | | 24 | + type: types, | 13 | 25 | millions: [1] | 14 | 26 | }); | 15 | 27 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/buffer-write.js +19-6Lines changed: 19 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | var common = require('../common.js'); | | 3 | + | | 4 | +var types = [ | | 5 | + 'UInt8', | | 6 | + 'UInt16LE', | | 7 | + 'UInt16BE', | | 8 | + 'UInt32LE', | | 9 | + 'UInt32BE', | | 10 | + 'Int8', | | 11 | + 'Int16LE', | | 12 | + 'Int16BE', | | 13 | + 'Int32LE', | | 14 | + 'Int32BE', | | 15 | + 'FloatLE', | | 16 | + 'FloatBE', | | 17 | + 'DoubleLE', | | 18 | + 'DoubleBE' | | 19 | +]; | | 20 | + | 3 | 21 | var bench = common.createBenchmark(main, { | 4 | 22 | noAssert: ['false', 'true'], | 5 | 23 | buffer: ['fast', 'slow'], | 6 | | - type: ['UInt8', 'UInt16LE', 'UInt16BE', | 7 | | - 'UInt32LE', 'UInt32BE', | 8 | | - 'Int8', 'Int16LE', 'Int16BE', | 9 | | - 'Int32LE', 'Int32BE', | 10 | | - 'FloatLE', 'FloatBE', | 11 | | - 'DoubleLE', 'DoubleBE'], | | 24 | + type: types, | 12 | 25 | millions: [1] | 13 | 26 | }); | 14 | 27 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/buffers/dataview-set.js +19-6Lines changed: 19 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | 'use strict'; | 2 | 2 | var common = require('../common.js'); | | 3 | + | | 4 | +var types = [ | | 5 | + 'Uint8', | | 6 | + 'Uint16LE', | | 7 | + 'Uint16BE', | | 8 | + 'Uint32LE', | | 9 | + 'Uint32BE', | | 10 | + 'Int8', | | 11 | + 'Int16LE', | | 12 | + 'Int16BE', | | 13 | + 'Int32LE', | | 14 | + 'Int32BE', | | 15 | + 'Float32LE', | | 16 | + 'Float32BE', | | 17 | + 'Float64LE', | | 18 | + 'Float64BE' | | 19 | +]; | | 20 | + | 3 | 21 | var bench = common.createBenchmark(main, { | 4 | | - type: ['Uint8', 'Uint16LE', 'Uint16BE', | 5 | | - 'Uint32LE', 'Uint32BE', | 6 | | - 'Int8', 'Int16LE', 'Int16BE', | 7 | | - 'Int32LE', 'Int32BE', | 8 | | - 'Float32LE', 'Float32BE', | 9 | | - 'Float64LE', 'Float64BE'], | | 22 | + type: types, | 10 | 23 | millions: [1] | 11 | 24 | }); | 12 | 25 |
| |
Collapse file Copy file name to clipboardExpand all lines: benchmark/es/map-bench.js +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ function runObject(n) { | 15 | 15 | for (; i < n; i++) { | 16 | 16 | m['i' + i] = i; | 17 | 17 | m['s' + i] = String(i); | 18 | | - assert.equal(m['i' + i], m['s' + i]); | | 18 | + assert.strictEqual(String(m['i' + i]), m['s' + i]); | 19 | 19 | m['i' + i] = undefined; | 20 | 20 | m['s' + i] = undefined; | 21 | 21 | } | @@ -29,7 +29,7 @@ function runNullProtoObject(n) { | 29 | 29 | for (; i < n; i++) { | 30 | 30 | m['i' + i] = i; | 31 | 31 | m['s' + i] = String(i); | 32 | | - assert.equal(m['i' + i], m['s' + i]); | | 32 | + assert.strictEqual(String(m['i' + i]), m['s' + i]); | 33 | 33 | m['i' + i] = undefined; | 34 | 34 | m['s' + i] = undefined; | 35 | 35 | } | @@ -53,7 +53,7 @@ function runFakeMap(n) { | 53 | 53 | for (; i < n; i++) { | 54 | 54 | m.set('i' + i, i); | 55 | 55 | m.set('s' + i, String(i)); | 56 | | - assert.equal(m.get('i' + i), m.get('s' + i)); | | 56 | + assert.strictEqual(String(m.get('i' + i)), m.get('s' + i)); | 57 | 57 | m.set('i' + i, undefined); | 58 | 58 | m.set('s' + i, undefined); | 59 | 59 | } | @@ -67,7 +67,7 @@ function runMap(n) { | 67 | 67 | for (; i < n; i++) { | 68 | 68 | m.set('i' + i, i); | 69 | 69 | m.set('s' + i, String(i)); | 70 | | - assert.equal(m.get('i' + i), m.get('s' + i)); | | 70 | + assert.strictEqual(String(m.get('i' + i)), m.get('s' + i)); | 71 | 71 | m.set('i' + i, undefined); | 72 | 72 | m.set('s' + i, undefined); | 73 | 73 | } | |
|