Closed anmarchenko closed 2 months ago
Attention: Patch coverage is 90.62500%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 98.86%. Comparing base (
7d381d5
) to head (777af47
).
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
What does this PR do? Applies some heuristics to avoid calling
Pathname#relative_path_from
function when determining what would be path relative to the git root for the given filepath:path[prefix_length..]
)Pathname#relative_path_from
once and then we store the difference between the relative filepath and the computed relative path from root in the@prefix_to_root
cached variable. We can do it because all relative paths are computed relative to theDir.pwd
which doesn't change in the lifetime of the process. After we have@prefix_to_root
cache, we prepend it to every filepath we get (or just return the filepath if the tests are running from the git root).Motivation Profiling rubocop test suite with Datadog continuous profiler showed that big part of CPU time is spent in
Datadog::CI::Git::LocalRepository.relative_to_root
function:How to test the change? Unit tests are provided.
Benchmark results: