Avoid Gitaly calls when evaluating `exists` conditional
What does this MR do and why?
This MR reduces the number of Gitaly calls it takes to evaluate exists rules.
Currently, for every build with an exists conditional, we issue a Gitaly request, to check if the repository tree satisfies the conditional. We can instead read the filenames from Gitaly only once, since rules evaluate for the same ref.
Related to #472223 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
-
Create a new project and note its ID
-
Commit this
gitlab.ymlwith 100 jobs or generate one yourself withgen.rb:bundle exec ruby gen.rb 100 -
Retrieve
bench.rband run the benchmark for the project ID:bin/rails runner bench.rb -- benchmark 296
Local output:
% bin/rails runner bench.rb -- benchmark 298
Warming up --------------------------------------
enabled 1.000 i/100ms
disabled 1.000 i/100ms
Calculating -------------------------------------
enabled 2.319 (± 0.0%) i/s - 12.000 in 5.183742s
disabled 0.151 (± 0.0%) i/s - 1.000 in 6.613193s
Comparison:
enabled: 2.3 i/s
disabled: 0.2 i/s - 15.34x slower
Edited by Dominic Bauer