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/net/net-c2s-cork.js | |
parent | 9348f31c2aec996cf6cf7731244b2d76153440ea (diff) | |
download | android-node-v8-74dc3bfe08b8f0a47759206d3d9d4d6f5a0528c1.tar.gz android-node-v8-74dc3bfe08b8f0a47759206d3d9d4d6f5a0528c1.tar.bz2 android-node-v8-74dc3bfe08b8f0a47759206d3d9d4d6f5a0528c1.zip |
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/net/net-c2s-cork.js')
-rw-r--r-- | benchmark/net/net-c2s-cork.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/benchmark/net/net-c2s-cork.js b/benchmark/net/net-c2s-cork.js index 6af9162025..4a119e9c27 100644 --- a/benchmark/net/net-c2s-cork.js +++ b/benchmark/net/net-c2s-cork.js @@ -27,11 +27,11 @@ function main(conf) { break; case 'utf': encoding = 'utf8'; - chunk = new Array(len / 2 + 1).join('ü'); + chunk = 'ü'.repeat(len / 2); break; case 'asc': encoding = 'ascii'; - chunk = new Array(len + 1).join('x'); + chunk = 'x'.repeat(len); break; default: throw new Error('invalid type: ' + type); |