fix: improve execution requirements of all copy files/directory rules for better perf #79
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.
Inspired by bazelbuild/rules_nodejs#3410
Copying file & directories is entirely IO-bound and there is no point doing this work
remotely.
Also, remote-execution does not allow source directory inputs, see
bazelbuild/bazel@c64421b So we must
not attempt to execute remotely in that case.
There is also no point pulling the output file or directory from the remote cache since the
bytes to copy are already available locally. Conversely, no point in writing to the cache if
no one has any reason to check it for this action.
Read and writing to disk cache is disabled as well primarily to reduce disk usage on the local
machine. A disk cache hit of a directory copy could be slghtly faster than a copy since the
disk cache stores the directory artifact as a single entry, but the slight performance bump
comes at the cost of heavy disk cache usage, which is an unmanaged directory that grow beyond
the bounds of the physical disk.
Sandboxing for this action is wasteful as well since there is a 1:1 mapping of input
file/directory to output file/directory and no room for non-hermetic inputs to sneak in to the
input.
I will run benchmarks to measure the impact on copy_directory with no-cache in a follow-up to this PR