Improve performance of looking up some SCMTool flags.

Review Request #11131 — Created Aug. 10, 2020 and submitted

Information

Review Board
release-4.0.x

Reviewers

We had some call sites that inspected flags on a repository's SCMTool,
in order to handle some logic or relay capabilities elsewhere. Some of
these call sites were fetching the tool directly, in some cases
instantiating it, and then accessing the flags. For instance, there were
many blocks of code accessing SCMTool.diffs_use_absolute_paths
inefficiently.

We already had wrappers in Repository for accessing some of these
flags, which was more efficient. These looked up by class when possible,
instantiating only if necessary. In other cases, the flags could be
looked up on the class, rather than needing an instance.

This change updates all references to use the wrappers in the
Repository. It also makes the Repository.diffs_use_absolute_paths
wrapper properly a cached_property, to avoid repeated lookups and
instantiations.

Unit tests pass.

Summary ID
Improve performance of looking up some SCMTool flags.
We had some call sites that inspected flags on a repository's `SCMTool`, in order to handle some logic or relay capabilities elsewhere. Some of these call sites were fetching the tool directly, in some cases instantiating it, and then accessing the flags. For instance, there were many blocks of code accessing `SCMTool.diffs_use_absolute_paths` inefficiently. We already had wrappers in `Repository` for accessing some of these flags, which was more efficient. These looked up by class when possible, instantiating only if necessary. In other cases, the flags could be looked up on the class, rather than needing an instance. This change updates all references to use the wrappers in the `Repository`. It also makes the `Repository.diffs_use_absolute_paths` wrapper properly a `cached_property`, to avoid repeated lookups and instantiations.
000c395de9624ec45498fb268ef9472506be314b
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (08a7574)
Loading...