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
8d5f560
benchmark: (arrays) use destructuring
BridgeAR Dec 30, 2017
eb5a92d
benchmark: (assert) use destructuring
BridgeAR Dec 30, 2017
a48a321
benchmark: (url) use destructuring
BridgeAR Dec 30, 2017
52fc567
benchmark: (zlib) use destructuring
BridgeAR Dec 30, 2017
e6eb394
benchmark: (util/v8/vm) use destructuring
BridgeAR Dec 30, 2017
8e977c3
benchmark: (tls) use destructuring
BridgeAR Dec 30, 2017
0d05d11
benchmark: (timers) use destructuring
BridgeAR Dec 30, 2017
912458b
benchmark: (streams) use destructuring
BridgeAR Dec 30, 2017
1cc8db1
benchmark: (querystring) use destructuring
BridgeAR Dec 30, 2017
f30a2bd
benchmark: (process) use destructuring
BridgeAR Dec 30, 2017
b2e8cca
benchmark: (net) use destructuring
BridgeAR Dec 30, 2017
c5879c3
benchmark: (os) use destructuring
BridgeAR Dec 30, 2017
c5a1819
benchmark: (path) use destructuring
BridgeAR Dec 30, 2017
ed55a5e
benchmark: (string_decoder) use destructuring
BridgeAR Dec 30, 2017
430bb2c
benchmark: (http2) use destructuring
BridgeAR Dec 30, 2017
2f49067
benchmark: (misc) use destructuring
BridgeAR Dec 30, 2017
69bfcbc
benchmark: (http) use destructuring
BridgeAR Dec 30, 2017
cdfb609
benchmark: (fs) use destructuring
BridgeAR Dec 30, 2017
abc7eec
benchmark: (es) use destructuring
BridgeAR Dec 30, 2017
3011f0a
benchmark: (events) use destructuring
BridgeAR Dec 30, 2017
f2d920b
benchmark: (buffers) use destructuring
BridgeAR Dec 30, 2017
d766d57
benchmark: (child_process) use destructuring
BridgeAR Dec 30, 2017
59b5962
benchmark: (dgram) use destructuring
BridgeAR Dec 30, 2017
bf6ea9e
benchmark: (async_hooks/dns/cluster/domain/module) 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
  • Loading branch information
BridgeAR committed Jan 19, 2018
commit 59b5962cdeded08209d2e359d64f309b1ef6dc2f
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