Skip to content

use the index state to detect whether there are conflicted files present - #7476

Merged
outofambit merged 10 commits into
developmentfrom
only-look-for-stash-conflicts-sometimes
May 9, 2019
Merged

outofambit merged 10 commits into
developmentfrom
only-look-for-stash-conflicts-sometimes

Conversation

@shiftkey

@shiftkey shiftkey commented May 7, 2019

Copy link
Copy Markdown
Member

Overview

Related to #7464

Description

This PR tunes a code path inside getStatus that was introduced as part of the new stash flow in #7380. The original implementation was a naive "do we have changes?" check and it turns out that git diff is rather expensive when dealing with a large number of working directory changes.

Here's a profile of a refresh in the nodejs/node repository when all of the files are marked for deletion (I've highlighted the overall timing):

You'll note that getFilesWithConflictMarkers and getBinaryPaths take a combined 4.7 seconds, or about 85% of the overall 5.5 seconds it takes to refresh.

You can also see these fire again outside the scope of the refresh, but I've opened #7475 because I think that work is unnecessary:

The fix I settled on was to look at the index for unmerged files if we cannot detect a merge or rebase in progress. If we do not detect any unmerged files in the index, I believe we can skip doing any git diff invocations and save time.

Release notes

Notes: [Improved] checks for stashing conflicts only when the right state found in index

@shiftkey
shiftkey force-pushed the only-look-for-stash-conflicts-sometimes branch from 25ea40d to fd7bc61 Compare May 7, 2019 19:36
@shiftkey
shiftkey requested a review from outofambit May 7, 2019 19:37
@shiftkey shiftkey added ready-for-review Pull Requests that are ready to be reviewed by the maintainers performance Relating to things affecting performance labels May 7, 2019
Comment thread app/src/lib/git/status.ts Resolved
Comment thread app/src/lib/git/status.ts Resolved
Comment thread app/test/unit/git/stash-test.ts Resolved
@outofambit outofambit added the epic:stashing Tracking label for work related to the stashing flow label May 7, 2019
@outofambit outofambit self-assigned this May 7, 2019
@outofambit outofambit added this to the 1.7.0 milestone May 7, 2019
@shiftkey
shiftkey requested a review from outofambit May 8, 2019 12:18

@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.

this looks great! i know there's a little more we could do to make the file status checking faster, so @shiftkey let us know when you're done looking into that. i think this is fine to merge as is since it should still be a marked improvement over current performance.

Comment thread app/src/lib/git/rebase.ts
export async function getRebaseInternalState(
repository: Repository
): Promise<RebaseInternalState | null> {
if (!enablePullWithRebase()) {

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.

nice

@shiftkey

shiftkey commented May 8, 2019

Copy link
Copy Markdown
Member Author

@outofambit I'm going to revisit the file status checking after the collection of outstanding PRs are reviewed/merged/available on beta, because at this point I want to avoid looking at issues that are resolved elsewhere.

@outofambit
outofambit merged commit 6974d66 into development May 9, 2019
@outofambit
outofambit deleted the only-look-for-stash-conflicts-sometimes branch May 9, 2019 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

epic:stashing Tracking label for work related to the stashing flow 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.

2 participants