Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 372e3ee

Browse filesBrowse files
mscdexItalo A. Casas
authored andcommitted
benchmark: improve readability of net benchmarks
PR-URL: #10446 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d19136d commit 372e3ee
Copy full SHA for 372e3ee

File tree

Expand file treeCollapse file tree

3 files changed

+30
-30
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+30
-30
lines changed
Open diff view settings
Collapse file

‎benchmark/net/net-c2s.js‎

Copy file name to clipboardExpand all lines: benchmark/net/net-c2s.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,17 @@ Writer.prototype.emit = function() {};
6565
Writer.prototype.prependListener = function() {};
6666

6767

68+
function flow() {
69+
var dest = this.dest;
70+
var res = dest.write(chunk, encoding);
71+
if (!res)
72+
dest.once('drain', this.flow);
73+
else
74+
process.nextTick(this.flow);
75+
}
76+
6877
function Reader() {
69-
this.flow = this.flow.bind(this);
78+
this.flow = flow.bind(this);
7079
this.readable = true;
7180
}
7281

@@ -76,15 +85,6 @@ Reader.prototype.pipe = function(dest) {
7685
return dest;
7786
};
7887

79-
Reader.prototype.flow = function() {
80-
var dest = this.dest;
81-
var res = dest.write(chunk, encoding);
82-
if (!res)
83-
dest.once('drain', this.flow);
84-
else
85-
process.nextTick(this.flow);
86-
};
87-
8888

8989
function server() {
9090
var reader = new Reader();
Collapse file

‎benchmark/net/net-pipe.js‎

Copy file name to clipboardExpand all lines: benchmark/net/net-pipe.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,17 @@ Writer.prototype.emit = function() {};
6565
Writer.prototype.prependListener = function() {};
6666

6767

68+
function flow() {
69+
var dest = this.dest;
70+
var res = dest.write(chunk, encoding);
71+
if (!res)
72+
dest.once('drain', this.flow);
73+
else
74+
process.nextTick(this.flow);
75+
}
76+
6877
function Reader() {
69-
this.flow = this.flow.bind(this);
78+
this.flow = flow.bind(this);
7079
this.readable = true;
7180
}
7281

@@ -76,15 +85,6 @@ Reader.prototype.pipe = function(dest) {
7685
return dest;
7786
};
7887

79-
Reader.prototype.flow = function() {
80-
var dest = this.dest;
81-
var res = dest.write(chunk, encoding);
82-
if (!res)
83-
dest.once('drain', this.flow);
84-
else
85-
process.nextTick(this.flow);
86-
};
87-
8888

8989
function server() {
9090
var reader = new Reader();
Collapse file

‎benchmark/net/net-s2c.js‎

Copy file name to clipboardExpand all lines: benchmark/net/net-s2c.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,17 @@ Writer.prototype.emit = function() {};
6565
Writer.prototype.prependListener = function() {};
6666

6767

68+
function flow() {
69+
var dest = this.dest;
70+
var res = dest.write(chunk, encoding);
71+
if (!res)
72+
dest.once('drain', this.flow);
73+
else
74+
process.nextTick(this.flow);
75+
}
76+
6877
function Reader() {
69-
this.flow = this.flow.bind(this);
78+
this.flow = flow.bind(this);
7079
this.readable = true;
7180
}
7281

@@ -76,15 +85,6 @@ Reader.prototype.pipe = function(dest) {
7685
return dest;
7786
};
7887

79-
Reader.prototype.flow = function() {
80-
var dest = this.dest;
81-
var res = dest.write(chunk, encoding);
82-
if (!res)
83-
dest.once('drain', this.flow);
84-
else
85-
process.nextTick(this.flow);
86-
};
87-
8888

8989
function server() {
9090
var reader = new Reader();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.