Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2016-12-25 07:29:22 +0300
committerItalo A. Casas <me@italoacasas.com>2017-01-27 16:11:46 +0300
commit372e3eeb4bb45203562ec9f1e4189a094949dd14 (patch)
treef291badf8cc70bec6be87ca8270d82f69b325d9c /benchmark
parentd19136da84780003570ecffc378a2e4ce2beef1e (diff)
benchmark: improve readability of net benchmarks
PR-URL: https://github.com/nodejs/node/pull/10446 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/net/net-c2s.js20
-rw-r--r--benchmark/net/net-pipe.js20
-rw-r--r--benchmark/net/net-s2c.js20
3 files changed, 30 insertions, 30 deletions
diff --git a/benchmark/net/net-c2s.js b/benchmark/net/net-c2s.js
index 9b4df2f5a79..7e59bc528b6 100644
--- a/benchmark/net/net-c2s.js
+++ b/benchmark/net/net-c2s.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();
diff --git a/benchmark/net/net-pipe.js b/benchmark/net/net-pipe.js
index 03db348878e..7d4849c4ef7 100644
--- a/benchmark/net/net-pipe.js
+++ b/benchmark/net/net-pipe.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();
diff --git a/benchmark/net/net-s2c.js b/benchmark/net/net-s2c.js
index 469b66a25a3..a4a5b4ab498 100644
--- a/benchmark/net/net-s2c.js
+++ b/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();