Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DVCS Graph tweaks #4986

Merged
merged 36 commits into from May 27, 2018
Merged

DVCS Graph tweaks #4986

merged 36 commits into from May 27, 2018

Conversation

drewnoakes
Copy link
Member

This PR contains small commits I've cherry-picked out of another PR related to revision loading performance. Probably easiest to review commit-by-commit as the overall diff is a tad confusing in places.

Changes proposed in this pull request:

  • Several small screws tightened, such as:
    • Reduce allocations
    • Remove unused code
    • Use IReadOnlyList<T>
    • Reduce visibilities
  • Add left/right padding to the graph UI (see screenshots below)

Screenshots

The only visual change is the padding around the graph. Notice how the 'margin' on the left/right matches that at the top afterwards.

Before

image

After

image

What did I do to test the code and ensure quality:

  • Lots of manual testing

I'd prefer this not to be squashed, as any problems will be easier to identify via bisect with small commits.

Has been tested on:

  • GIT 2.16.02
  • Windows 10

Previously, the graph was pressed hard up against the left edge.
This commit adds some space to either side of the graph so it's
more pleasing on the eye.
Removes duplicate dimension values from RevisionGrid, keeping
those in DvcsGraph.
Hoists constant array to field.

Reuse adjacent colours list via field. Assert always on UI thread so
that this is safe.
Previously the list of junction colours would be created within nested
for loops, resulting in potentially very many redundant collections.

This makes the collection a field and reuses it. We assert we are on the
UI thread so that this is always safe.
@codecov
Copy link

codecov bot commented May 27, 2018

Codecov Report

Merging #4986 into master will increase coverage by 0.04%.
The diff coverage is 8.88%.

@@            Coverage Diff             @@
##           master    #4986      +/-   ##
==========================================
+ Coverage   34.23%   34.27%   +0.04%     
==========================================
  Files         546      546              
  Lines       43708    43647      -61     
  Branches     6023     6014       -9     
==========================================
  Hits        14962    14962              
+ Misses      28007    27947      -60     
+ Partials      739      738       -1

Copy link
Member

@RussKie RussKie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top job!

Could you clarify the intent for d176711? "Avoid load" lacks clarity.

public readonly List<Junction> Ancestors = new List<Junction>();
public readonly List<Junction> Descendants = new List<Junction>();
public readonly List<Junction> Ancestors = new List<Junction>(capacity: 2);
public readonly List<Junction> Descendants = new List<Junction>(capacity: 2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand a node having only two ancestors, but can it not have more than 2 descendants?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When loading the GE repo in GE, this change avoids ~2MB of redundant heap allocation.

These values don't represent hard limits as the lists can resize if necessary.

The assumption here is that the vast majority of nodes wouldn't have more than two ancestors or descendants.

List<T> has a default capacity of 16 (possibly implementation specific), we save 14 items in each of 2 collections on every node. On GE we have just over 10,000 commits.

So for GE on a 64 bit process allocations are reduced by 14*2*10,000*8 = 1,920,000 bytes.

Maybe we should go further. If we use default capacities of 1 then we would save 2*10,000*8 = 160,000 additional bytes (8% more), but have to resize the array for merge commits etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the explanation 👍

@RussKie RussKie merged commit 46117b3 into gitextensions:master May 27, 2018
@RussKie RussKie added this to the 3.00 milestone May 27, 2018
@drewnoakes drewnoakes deleted the dvcs-graph branch May 27, 2018 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants