Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

benchmark: tidy net benchmarks #10446

Merged
merged 2 commits into from
Jan 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
File renamed without changes.
20 changes: 10 additions & 10 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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();
Expand Down
20 changes: 10 additions & 10 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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();
Expand Down
20 changes: 10 additions & 10 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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();
Expand Down