diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2017-09-13 22:48:53 -0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2017-09-19 21:14:38 -0300 |
commit | e167ab71fb113fa38866dd11aa99af7079fb463c (patch) | |
tree | 3d91ca0f6e60d08fcab70833b851335e41b53cd0 /benchmark/crypto/hash-stream-throughput.js | |
parent | b1c8f15c5f169e021f7c46eb7b219de95fe97603 (diff) | |
download | android-node-v8-e167ab71fb113fa38866dd11aa99af7079fb463c.tar.gz android-node-v8-e167ab71fb113fa38866dd11aa99af7079fb463c.tar.bz2 android-node-v8-e167ab71fb113fa38866dd11aa99af7079fb463c.zip |
benchmark: var to const
PR-URL: https://github.com/nodejs/node/pull/13757
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'benchmark/crypto/hash-stream-throughput.js')
-rw-r--r-- | benchmark/crypto/hash-stream-throughput.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/benchmark/crypto/hash-stream-throughput.js b/benchmark/crypto/hash-stream-throughput.js index cedaeb872f..21ec3c7902 100644 --- a/benchmark/crypto/hash-stream-throughput.js +++ b/benchmark/crypto/hash-stream-throughput.js @@ -1,10 +1,10 @@ // throughput benchmark // creates a single hasher, then pushes a bunch of data through it 'use strict'; -var common = require('../common.js'); -var crypto = require('crypto'); +const common = require('../common.js'); +const crypto = require('crypto'); -var bench = common.createBenchmark(main, { +const bench = common.createBenchmark(main, { writes: [500], algo: ['sha1', 'sha256', 'sha512'], type: ['asc', 'utf', 'buf'], @@ -38,17 +38,17 @@ function main(conf) { throw new Error(`unknown message type: ${conf.type}`); } - var fn = api === 'stream' ? streamWrite : legacyWrite; + const fn = api === 'stream' ? streamWrite : legacyWrite; bench.start(); fn(conf.algo, message, encoding, conf.writes, conf.len); } function legacyWrite(algo, message, encoding, writes, len) { - var written = writes * len; - var bits = written * 8; - var gbits = bits / (1024 * 1024 * 1024); - var h = crypto.createHash(algo); + const written = writes * len; + const bits = written * 8; + const gbits = bits / (1024 * 1024 * 1024); + const h = crypto.createHash(algo); while (writes-- > 0) h.update(message, encoding); @@ -59,10 +59,10 @@ function legacyWrite(algo, message, encoding, writes, len) { } function streamWrite(algo, message, encoding, writes, len) { - var written = writes * len; - var bits = written * 8; - var gbits = bits / (1024 * 1024 * 1024); - var h = crypto.createHash(algo); + const written = writes * len; + const bits = written * 8; + const gbits = bits / (1024 * 1024 * 1024); + const h = crypto.createHash(algo); while (writes-- > 0) h.write(message, encoding); |