Brian White
8 years ago
No known key found for this signature in database
GPG Key ID: 606D7358F94DA209
3 changed files with
30 additions and
30 deletions
-
benchmark/net/net-c2s.js
-
benchmark/net/net-pipe.js
-
benchmark/net/net-s2c.js
|
|
@ -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(); |
|
|
|