summaryrefslogtreecommitdiff
path: root/benchmark/crypto/cipher-stream.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-02-27 21:56:18 -0800
committerRich Trott <rtrott@gmail.com>2016-03-01 13:48:42 -0800
commit76e4a7437791a9b02f86d1f6db5ddc94f9913d09 (patch)
tree91641596875410fa9fe290d955403d6ab0580f51 /benchmark/crypto/cipher-stream.js
parent859269724cfd02ed2d1401f81c4b80d0619941b2 (diff)
downloadandroid-node-v8-76e4a7437791a9b02f86d1f6db5ddc94f9913d09.tar.gz
android-node-v8-76e4a7437791a9b02f86d1f6db5ddc94f9913d09.tar.bz2
android-node-v8-76e4a7437791a9b02f86d1f6db5ddc94f9913d09.zip
benchmark: refactor to eliminate redeclared vars
In order to comply with linting rules used in the rest of the code base, eliminate redeclared variables. A conservative approach is used so as to avoid unintentional performance issues (for example, as might be seen in some situations when using `let` instead of `var`). PR-URL: https://github.com/nodejs/node/pull/5468 Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'benchmark/crypto/cipher-stream.js')
-rw-r--r--benchmark/crypto/cipher-stream.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/benchmark/crypto/cipher-stream.js b/benchmark/crypto/cipher-stream.js
index affed1b462..5da6f2481e 100644
--- a/benchmark/crypto/cipher-stream.js
+++ b/benchmark/crypto/cipher-stream.js
@@ -86,13 +86,14 @@ function streamWrite(alice, bob, message, encoding, writes) {
function legacyWrite(alice, bob, message, encoding, writes) {
var written = 0;
+ var enc, dec;
for (var i = 0; i < writes; i++) {
- var enc = alice.update(message, encoding);
- var dec = bob.update(enc);
+ enc = alice.update(message, encoding);
+ dec = bob.update(enc);
written += dec.length;
}
- var enc = alice.final();
- var dec = bob.update(enc);
+ enc = alice.final();
+ dec = bob.update(enc);
written += dec.length;
dec = bob.final();
written += dec.length;