summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-26 05:21:27 +0100
committerMichaël Zasso <targos@protonmail.com>2019-03-30 13:16:39 +0100
commitf86f5736da72ad4f3fb50692461222590e2f0258 (patch)
tree6fee263bfca24abbf76b7a3f1517b8184c29f077 /benchmark
parentf0b3855a90bc5f68fe38ea5e7c69d30ae7d81a27 (diff)
downloadandroid-node-v8-f86f5736da72ad4f3fb50692461222590e2f0258.tar.gz
android-node-v8-f86f5736da72ad4f3fb50692461222590e2f0258.tar.bz2
android-node-v8-f86f5736da72ad4f3fb50692461222590e2f0258.zip
benchmark,lib: change var to const
Refs: https://github.com/nodejs/node/pull/26679 PR-URL: https://github.com/nodejs/node/pull/26915 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/fs/readfile-partitioned.js2
-rw-r--r--benchmark/fs/write-stream-throughput.js2
-rw-r--r--benchmark/http/_chunky_http_client.js2
-rw-r--r--benchmark/http/http_server_for_chunky_client.js4
-rw-r--r--benchmark/http/set-header.js2
-rw-r--r--benchmark/http/simple.js2
-rw-r--r--benchmark/http/upgrade.js2
-rw-r--r--benchmark/tls/throughput.js3
-rw-r--r--benchmark/tls/tls-connect.js2
9 files changed, 9 insertions, 12 deletions
diff --git a/benchmark/fs/readfile-partitioned.js b/benchmark/fs/readfile-partitioned.js
index 2775793e0b..90af3754ce 100644
--- a/benchmark/fs/readfile-partitioned.js
+++ b/benchmark/fs/readfile-partitioned.js
@@ -29,7 +29,7 @@ function main(conf) {
fs.writeFileSync(filename, data);
data = null;
- var zipData = Buffer.alloc(1024, 'a');
+ const zipData = Buffer.alloc(1024, 'a');
var reads = 0;
var zips = 0;
diff --git a/benchmark/fs/write-stream-throughput.js b/benchmark/fs/write-stream-throughput.js
index bc88330929..3936adc7ff 100644
--- a/benchmark/fs/write-stream-throughput.js
+++ b/benchmark/fs/write-stream-throughput.js
@@ -38,7 +38,7 @@ function main({ dur, encodingType, size }) {
var started = false;
var ended = false;
- var f = fs.createWriteStream(filename);
+ const f = fs.createWriteStream(filename);
f.on('drain', write);
f.on('open', write);
f.on('close', done);
diff --git a/benchmark/http/_chunky_http_client.js b/benchmark/http/_chunky_http_client.js
index 21418a7c26..5164f8c619 100644
--- a/benchmark/http/_chunky_http_client.js
+++ b/benchmark/http/_chunky_http_client.js
@@ -54,7 +54,7 @@ function main({ len, n }) {
const add = 11;
var count = 0;
const PIPE = process.env.PIPE_NAME;
- var socket = net.connect(PIPE, () => {
+ const socket = net.connect(PIPE, () => {
bench.start();
WriteHTTPHeaders(socket, 1, len);
socket.setEncoding('utf8');
diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js
index edcacf5d12..ef0a23a029 100644
--- a/benchmark/http/http_server_for_chunky_client.js
+++ b/benchmark/http/http_server_for_chunky_client.js
@@ -10,9 +10,7 @@ process.env.PIPE_NAME = PIPE;
tmpdir.refresh();
-var server;
-
-server = http.createServer((req, res) => {
+const server = http.createServer((req, res) => {
const headers = {
'content-type': 'text/plain',
'content-length': '2'
diff --git a/benchmark/http/set-header.js b/benchmark/http/set-header.js
index 01cd8492df..1909c0991d 100644
--- a/benchmark/http/set-header.js
+++ b/benchmark/http/set-header.js
@@ -17,7 +17,7 @@ const c = 50;
// setHeaderWH: setHeader(...), writeHead(status, ...)
function main({ res }) {
process.env.PORT = PORT;
- var server = require('../fixtures/simple-http-server.js')
+ const server = require('../fixtures/simple-http-server.js')
.listen(PORT)
.on('listening', () => {
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
diff --git a/benchmark/http/simple.js b/benchmark/http/simple.js
index 2d89dce9be..95409faa9a 100644
--- a/benchmark/http/simple.js
+++ b/benchmark/http/simple.js
@@ -11,7 +11,7 @@ const bench = common.createBenchmark(main, {
});
function main({ type, len, chunks, c, chunkedEnc, res }) {
- var server = require('../fixtures/simple-http-server.js')
+ const server = require('../fixtures/simple-http-server.js')
.listen(common.PORT)
.on('listening', () => {
const path = `/${type}/${len}/${chunks}/normal/${chunkedEnc}`;
diff --git a/benchmark/http/upgrade.js b/benchmark/http/upgrade.js
index c286cdb264..8d365fe46d 100644
--- a/benchmark/http/upgrade.js
+++ b/benchmark/http/upgrade.js
@@ -19,7 +19,7 @@ const resData = 'HTTP/1.1 101 Web Socket Protocol Handshake\r\n' +
'\r\n\r\n';
function main({ n }) {
- var server = require('../fixtures/simple-http-server.js')
+ const server = require('../fixtures/simple-http-server.js')
.listen(common.PORT)
.on('listening', () => {
bench.start();
diff --git a/benchmark/tls/throughput.js b/benchmark/tls/throughput.js
index 3c0c2d4ea1..cd957ff1ed 100644
--- a/benchmark/tls/throughput.js
+++ b/benchmark/tls/throughput.js
@@ -14,7 +14,6 @@ const tls = require('tls');
function main({ dur, type, size }) {
var encoding;
- var server;
var chunk;
switch (type) {
case 'buf':
@@ -39,7 +38,7 @@ function main({ dur, type, size }) {
ciphers: 'AES256-GCM-SHA384'
};
- server = tls.createServer(options, onConnection);
+ const server = tls.createServer(options, onConnection);
var conn;
server.listen(common.PORT, () => {
const opt = { port: common.PORT, rejectUnauthorized: false };
diff --git a/benchmark/tls/tls-connect.js b/benchmark/tls/tls-connect.js
index 470d536f87..fa6e2cb80a 100644
--- a/benchmark/tls/tls-connect.js
+++ b/benchmark/tls/tls-connect.js
@@ -46,7 +46,7 @@ function makeConnection() {
port: common.PORT,
rejectUnauthorized: false
};
- var conn = tls.connect(options, () => {
+ const conn = tls.connect(options, () => {
clientConn++;
conn.on('error', (er) => {
console.error('client error', er);