Skip to content

avoid invoking status when updating indicator for current repository - #7475

Merged
shiftkey merged 9 commits into
developmentfrom
shiftkey/no-duplicate-get-status-needed
May 13, 2019
Merged

shiftkey merged 9 commits into
developmentfrom
shiftkey/no-duplicate-get-status-needed

Conversation

@shiftkey

@shiftkey shiftkey commented May 7, 2019

Copy link
Copy Markdown
Member

Overview

Related to #7464

Description

Whenever AppStore._refreshRepository runs (updating the current repository), it also runs AppStore.refreshIndicatorsForRepositories at the end.

Internally this does two expensive things:

  • run AppStore._loadStatus() to see whether there are working directory changes
  • run AppStore.fetch() to background fetch and detect the ahead/behind of the current branch

This feels rather wasteful to do for the active repository, and we already have a AppStore._loadStatus() result from earlier in AppStore._refreshRepository that has sufficient information for this UI (are there working changes?).

Given this function opts out of fetching while refreshing, and we have a relatively recent getStatus result, this PR introduces a more explicit AppStore.updateSidebarIndicator that is now used in refreshRepository, and leaves the existing behaviour in AppStore.refreshAllSidebarIndicators to be run when the background refresh happens.

This PR eliminates three Git operations that run on every refresh (a git status and two git diff).

On a desktop/desktop repository with a clean working directory:

Before

After

On a nodejs/node repository with 33k files removed in the working directory:

Before

After

Release notes

Notes: no-notes

@shiftkey shiftkey added performance Relating to things affecting performance ready-for-review Pull Requests that are ready to be reviewed by the maintainers labels May 7, 2019
@shiftkey shiftkey changed the title avoid status when updating repository indicator for current repository avoid invoking status when updating repository indicator for current repository May 8, 2019
@shiftkey shiftkey changed the title avoid invoking status when updating repository indicator for current repository avoid invoking status when updating indicator for current repository May 8, 2019
@shiftkey
shiftkey force-pushed the shiftkey/no-duplicate-get-status-needed branch from 77b78ed to fb60f86 Compare May 9, 2019 17:50
@iAmWillShepherd iAmWillShepherd self-assigned this May 9, 2019
iAmWillShepherd
iAmWillShepherd previously approved these changes May 9, 2019

@iAmWillShepherd iAmWillShepherd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My comment doesn't need to hold up this PR since what's here works just fine.

Comment thread app/src/lib/stores/app-store.ts Resolved

@outofambit outofambit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

a couple tweaks, please, before we merge this. overall this is a nice refactor!

Comment thread app/src/lib/stores/app-store.ts Resolved
Comment thread app/src/lib/stores/app-store.ts Resolved
Comment thread app/src/lib/stores/app-store.ts Resolved
Comment thread app/src/lib/stores/app-store.ts Resolved
Comment thread app/src/lib/stores/app-store.ts Resolved
Comment thread app/src/lib/stores/app-store.ts Resolved
@shiftkey
shiftkey force-pushed the shiftkey/no-duplicate-get-status-needed branch from 21454ed to b74fdcd Compare May 10, 2019 11:17
@shiftkey
shiftkey requested review from iAmWillShepherd and outofambit and removed request for outofambit May 10, 2019 11:18
@outofambit outofambit self-assigned this May 10, 2019
@outofambit outofambit added this to the 1.7.0 milestone May 10, 2019
@shiftkey
shiftkey merged commit 74b6759 into development May 13, 2019
@shiftkey
shiftkey deleted the shiftkey/no-duplicate-get-status-needed branch May 13, 2019 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Relating to things affecting performance ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants