Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
aa6fdf1
benchmark: (arrays) use destructuring
BridgeAR Dec 30, 2017
52cfd34
benchmark: (assert) use destructuring
BridgeAR Dec 30, 2017
a47b478
benchmark: (url) use destructuring
BridgeAR Dec 30, 2017
d6d4b6b
benchmark: (zlib) use destructuring
BridgeAR Dec 30, 2017
e032fee
benchmark: (util/v8/vm) use destructuring
BridgeAR Dec 30, 2017
67d158c
benchmark: (tls) use destructuring
BridgeAR Dec 30, 2017
69e7083
benchmark: (timers) use destructuring
BridgeAR Dec 30, 2017
c84762f
benchmark: (streams) use destructuring
BridgeAR Dec 30, 2017
e841268
benchmark: (querystring) use destructuring
BridgeAR Dec 30, 2017
ae5a06f
benchmark: (process) use destructuring
BridgeAR Dec 30, 2017
15c3b26
benchmark: (net) use destructuring
BridgeAR Dec 30, 2017
8bfa3af
benchmark: (os) use destructuring
BridgeAR Dec 30, 2017
b4609ab
benchmark: (path) use destructuring
BridgeAR Dec 30, 2017
62976e0
benchmark: (string_decoder) use destructuring
BridgeAR Dec 30, 2017
7e0df93
benchmark: (http2) use destructuring
BridgeAR Dec 30, 2017
c56feec
benchmark: (misc) use destructuring
BridgeAR Dec 30, 2017
a0b8fa3
benchmark: (http) use destructuring
BridgeAR Dec 30, 2017
9473627
benchmark: (fs) use destructuring
BridgeAR Dec 30, 2017
c3adef5
benchmark: (es) use destructuring
BridgeAR Dec 30, 2017
7a7ecad
benchmark: (events) use destructuring
BridgeAR Dec 30, 2017
f90cd1d
benchmark: (buffers) use destructuring
BridgeAR Dec 30, 2017
d746d5a
benchmark: (child_process) use destructuring
BridgeAR Dec 30, 2017
171a010
benchmark: (dgram) use destructuring
BridgeAR Dec 30, 2017
3a99ff9
benchmark: use destructuring
BridgeAR Dec 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
benchmark: (dgram) use destructuring
PR-URL: #18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
BridgeAR committed Jan 23, 2018
commit 171a010f21f9e0cb9558d87deeacb6ada6ca42c5
26 changes: 4 additions & 22 deletions benchmark/dgram/array-vs-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

const common = require('../common.js');
const dgram = require('dgram');
const PORT = common.PORT;

// `num` is the number of send requests to queue up each time.
Expand All @@ -15,34 +16,15 @@ const bench = common.createBenchmark(main, {
dur: [5]
});

var dur;
var len;
var num;
var type;
var chunk;
var chunks;

function main(conf) {
dur = +conf.dur;
len = +conf.len;
num = +conf.num;
type = conf.type;
chunks = +conf.chunks;

chunk = [];
function main({ dur, len, num, type, chunks }) {
const chunk = [];
for (var i = 0; i < chunks; i++) {
chunk.push(Buffer.allocUnsafe(Math.round(len / chunks)));
}

server();
}

const dgram = require('dgram');

function server() {
// Server
var sent = 0;
const socket = dgram.createSocket('udp4');

const onsend = type === 'concat' ? onsendConcat : onsendMulti;

function onsendConcat() {
Expand Down
7 changes: 3 additions & 4 deletions benchmark/dgram/bind-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ const configs = {
const bench = common.createBenchmark(main, configs);
const noop = () => {};

function main(conf) {
const n = +conf.n;
const port = conf.port === 'true' ? 0 : undefined;
const address = conf.address === 'true' ? '0.0.0.0' : undefined;
function main({ n, port, address }) {
port = port === 'true' ? 0 : undefined;
address = address === 'true' ? '0.0.0.0' : undefined;

if (port !== undefined && address !== undefined) {
bench.start();
Expand Down
25 changes: 3 additions & 22 deletions benchmark/dgram/multi-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

const common = require('../common.js');
const dgram = require('dgram');
const PORT = common.PORT;

// `num` is the number of send requests to queue up each time.
Expand All @@ -15,31 +16,11 @@ const bench = common.createBenchmark(main, {
dur: [5]
});

var dur;
var len;
var num;
var type;
var chunk;
var chunks;

function main(conf) {
dur = +conf.dur;
len = +conf.len;
num = +conf.num;
type = conf.type;
chunks = +conf.chunks;

chunk = [];
function main({ dur, len, num, type, chunks }) {
const chunk = [];
for (var i = 0; i < chunks; i++) {
chunk.push(Buffer.allocUnsafe(Math.round(len / chunks)));
}

server();
}

const dgram = require('dgram');

function server() {
var sent = 0;
var received = 0;
const socket = dgram.createSocket('udp4');
Expand Down
21 changes: 3 additions & 18 deletions benchmark/dgram/offset-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

const common = require('../common.js');
const dgram = require('dgram');
const PORT = common.PORT;

// `num` is the number of send requests to queue up each time.
Expand All @@ -14,24 +15,8 @@ const bench = common.createBenchmark(main, {
dur: [5]
});

var dur;
var len;
var num;
var type;
var chunk;

function main(conf) {
dur = +conf.dur;
len = +conf.len;
num = +conf.num;
type = conf.type;
chunk = Buffer.allocUnsafe(len);
server();
}

const dgram = require('dgram');

function server() {
function main({ dur, len, num, type }) {
const chunk = Buffer.allocUnsafe(len);
var sent = 0;
var received = 0;
const socket = dgram.createSocket('udp4');
Expand Down
21 changes: 3 additions & 18 deletions benchmark/dgram/single-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'use strict';

const common = require('../common.js');
const dgram = require('dgram');
const PORT = common.PORT;

// `num` is the number of send requests to queue up each time.
Expand All @@ -14,24 +15,8 @@ const bench = common.createBenchmark(main, {
dur: [5]
});

var dur;
var len;
var num;
var type;
var chunk;

function main(conf) {
dur = +conf.dur;
len = +conf.len;
num = +conf.num;
type = conf.type;
chunk = Buffer.allocUnsafe(len);
server();
}

const dgram = require('dgram');

function server() {
function main({ dur, len, num, type }) {
const chunk = Buffer.allocUnsafe(len);
var sent = 0;
var received = 0;
const socket = dgram.createSocket('udp4');
Expand Down