This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Decrease command execution overhead #47
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In #46 I had introduced output streaming so that the commands' outputs could be seen in the log; this is useful for following the progress of a given command. In that PR I switched away from shelljs' execution because it was throwing nonsensical errors related to temporary files. The execution was refactored to use
spawnwhich seemingly adds a lot of overhead to the commands (this issue could to be related).shelljs seems to perform much better than
spawn; however, we would like to have a way of streaming the output into the logs without hindering performance. How to have both?1. From the shelljs source we can see that they're using
execFileSyncwhich apparently performs much better; through this PR we'll execute the commands the same way.2. To avoid having Node.js process the commands' streams we'll use
stdio: "inherit"which will forward them to the parent process (i.e. they'll be output to the console, therefore showing up in the logs).3. Since streams are not captured according to 2. but we still want to collect stdout for parsing the benchmarks' results, the output is redirected to a file with
teeand then read after the command finishes.