diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-04-03 00:32:50 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-04-04 09:19:18 -0700 |
commit | 74dc3bfe08b8f0a47759206d3d9d4d6f5a0528c1 (patch) | |
tree | 11c56785a6c9b4331314eee66f1dca0fff8b3176 /benchmark/tls | |
parent | 9348f31c2aec996cf6cf7731244b2d76153440ea (diff) | |
download | node-new-74dc3bfe08b8f0a47759206d3d9d4d6f5a0528c1.tar.gz |
benchmark: replace [].join() with ''.repeat()
Also add a benchmark to compare both ways to create strings.
PR-URL: https://github.com/nodejs/node/pull/12170
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/tls')
-rw-r--r-- | benchmark/tls/throughput.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/benchmark/tls/throughput.js b/benchmark/tls/throughput.js index d3b7d0c022..c2b389fe45 100644 --- a/benchmark/tls/throughput.js +++ b/benchmark/tls/throughput.js @@ -26,11 +26,11 @@ function main(conf) { chunk = Buffer.alloc(size, 'b'); break; case 'asc': - chunk = new Array(size + 1).join('a'); + chunk = 'a'.repeat(size); encoding = 'ascii'; break; case 'utf': - chunk = new Array(size / 2 + 1).join('ü'); + chunk = 'ü'.repeat(size / 2); encoding = 'utf8'; break; default: |