From 32da4a2219dfa1ef309606ae6316562d2f7791a9 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Tue, 11 Apr 2017 00:30:24 +0300 Subject: [PATCH] benchmark: replace more [].join() with ''.repeat() Refs: https://github.com/nodejs/node/pull/12170 PR-URL: https://github.com/nodejs/node/pull/12317 Reviewed-By: James M Snell --- benchmark/child_process/child-process-read.js | 2 +- benchmark/http/_chunky_http_client.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/child_process/child-process-read.js b/benchmark/child_process/child-process-read.js index b0128eb7969056..6fce35410eeb48 100644 --- a/benchmark/child_process/child-process-read.js +++ b/benchmark/child_process/child-process-read.js @@ -19,7 +19,7 @@ function main(conf) { const dur = +conf.dur; const len = +conf.len; - const msg = '"' + Array(len).join('.') + '"'; + const msg = `"${'.'.repeat(len)}"`; const options = { 'stdio': ['ignore', 'pipe', 'ignore'] }; const child = spawn('yes', [msg], options); diff --git a/benchmark/http/_chunky_http_client.js b/benchmark/http/_chunky_http_client.js index d4d60ac84d1796..d9e906927e1ce0 100644 --- a/benchmark/http/_chunky_http_client.js +++ b/benchmark/http/_chunky_http_client.js @@ -20,7 +20,7 @@ function main(conf) { // Chose 7 because 9 showed "Connection error" / "Connection closed" // An odd number could result in a better length dispersion. for (var i = 7; i <= 7 * 7 * 7; i *= 7) - headers.push(Array(i + 1).join('o')); + headers.push('o'.repeat(i)); function WriteHTTPHeaders(channel, has_keep_alive, extra_header_count) { todo = [];