Skip to content

Commit 0f69f40

Browse files
committed
benchmark: replace more [].join() with ''.repeat()
Refs: #12170 PR-URL: #12317 Reviewed-By: James M Snell <[email protected]>
1 parent 06c29a6 commit 0f69f40

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

benchmark/child_process/child-process-read.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function main(conf) {
1919
const dur = +conf.dur;
2020
const len = +conf.len;
2121

22-
const msg = '"' + Array(len).join('.') + '"';
22+
const msg = `"${'.'.repeat(len)}"`;
2323
const options = { 'stdio': ['ignore', 'pipe', 'ignore'] };
2424
const child = spawn('yes', [msg], options);
2525

benchmark/http/_chunky_http_client.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function main(conf) {
2020
// Chose 7 because 9 showed "Connection error" / "Connection closed"
2121
// An odd number could result in a better length dispersion.
2222
for (var i = 7; i <= 7 * 7 * 7; i *= 7)
23-
headers.push(Array(i + 1).join('o'));
23+
headers.push('o'.repeat(i));
2424

2525
function WriteHTTPHeaders(channel, has_keep_alive, extra_header_count) {
2626
todo = [];

0 commit comments

Comments
 (0)