Skip to content

Commit

Permalink
benchmark: use 'yes' instead of echo in a loop
Browse files Browse the repository at this point in the history
This changes child-process-exec-stdout benchmark to use 'yes' instead
of echo in a while loop. This makes this benchmark consistent with
child-process-read which already uses `yes` and allows this benchmark
to be executed on Windows.

Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: #8721
  • Loading branch information
bzoz authored and jasnell committed Sep 29, 2016
1 parent dfb5f30 commit e6328bb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions benchmark/child_process/child-process-exec-stdout.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ function main(conf) {
const msg = `"${'.'.repeat(len)}"`;
msg.match(/./);
const options = {'stdio': ['ignore', 'pipe', 'ignore']};
// NOTE: Command below assumes bash shell.
const child = exec(`while\n echo ${msg}\ndo :; done\n`, options);
const child = exec(`yes ${msg}`, options);

var bytes = 0;
child.stdout.on('data', function(msg) {
Expand Down

0 comments on commit e6328bb

Please sign in to comment.