mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
benchmark: improve readability of net benchmarks
PR-URL: https://github.com/nodejs/node/pull/10446 Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
@@ -65,8 +65,17 @@ Writer.prototype.emit = function() {};
|
||||
Writer.prototype.prependListener = function() {};
|
||||
|
||||
|
||||
function flow() {
|
||||
var dest = this.dest;
|
||||
var res = dest.write(chunk, encoding);
|
||||
if (!res)
|
||||
dest.once('drain', this.flow);
|
||||
else
|
||||
process.nextTick(this.flow);
|
||||
}
|
||||
|
||||
function Reader() {
|
||||
this.flow = this.flow.bind(this);
|
||||
this.flow = flow.bind(this);
|
||||
this.readable = true;
|
||||
}
|
||||
|
||||
@@ -76,15 +85,6 @@ Reader.prototype.pipe = function(dest) {
|
||||
return dest;
|
||||
};
|
||||
|
||||
Reader.prototype.flow = function() {
|
||||
var dest = this.dest;
|
||||
var res = dest.write(chunk, encoding);
|
||||
if (!res)
|
||||
dest.once('drain', this.flow);
|
||||
else
|
||||
process.nextTick(this.flow);
|
||||
};
|
||||
|
||||
|
||||
function server() {
|
||||
var reader = new Reader();
|
||||
|
||||
@@ -65,8 +65,17 @@ Writer.prototype.emit = function() {};
|
||||
Writer.prototype.prependListener = function() {};
|
||||
|
||||
|
||||
function flow() {
|
||||
var dest = this.dest;
|
||||
var res = dest.write(chunk, encoding);
|
||||
if (!res)
|
||||
dest.once('drain', this.flow);
|
||||
else
|
||||
process.nextTick(this.flow);
|
||||
}
|
||||
|
||||
function Reader() {
|
||||
this.flow = this.flow.bind(this);
|
||||
this.flow = flow.bind(this);
|
||||
this.readable = true;
|
||||
}
|
||||
|
||||
@@ -76,15 +85,6 @@ Reader.prototype.pipe = function(dest) {
|
||||
return dest;
|
||||
};
|
||||
|
||||
Reader.prototype.flow = function() {
|
||||
var dest = this.dest;
|
||||
var res = dest.write(chunk, encoding);
|
||||
if (!res)
|
||||
dest.once('drain', this.flow);
|
||||
else
|
||||
process.nextTick(this.flow);
|
||||
};
|
||||
|
||||
|
||||
function server() {
|
||||
var reader = new Reader();
|
||||
|
||||
@@ -65,8 +65,17 @@ Writer.prototype.emit = function() {};
|
||||
Writer.prototype.prependListener = function() {};
|
||||
|
||||
|
||||
function flow() {
|
||||
var dest = this.dest;
|
||||
var res = dest.write(chunk, encoding);
|
||||
if (!res)
|
||||
dest.once('drain', this.flow);
|
||||
else
|
||||
process.nextTick(this.flow);
|
||||
}
|
||||
|
||||
function Reader() {
|
||||
this.flow = this.flow.bind(this);
|
||||
this.flow = flow.bind(this);
|
||||
this.readable = true;
|
||||
}
|
||||
|
||||
@@ -76,15 +85,6 @@ Reader.prototype.pipe = function(dest) {
|
||||
return dest;
|
||||
};
|
||||
|
||||
Reader.prototype.flow = function() {
|
||||
var dest = this.dest;
|
||||
var res = dest.write(chunk, encoding);
|
||||
if (!res)
|
||||
dest.once('drain', this.flow);
|
||||
else
|
||||
process.nextTick(this.flow);
|
||||
};
|
||||
|
||||
|
||||
function server() {
|
||||
var reader = new Reader();
|
||||
|
||||
Reference in New Issue
Block a user