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

Commit count: Listing ignored files could hang GE #4328

Conversation

gerhardol
Copy link
Member

@gerhardol gerhardol commented Jan 7, 2018

Should be reviewed together with #4327, this PR is based on #4327 even if the changes can be separated.

Issue #4256
Listing ignored files with a separate "ls-files -o -i --exclude-standard" seem to never exit in some situations, see #4256
This reuses the git-status call with --ignored as an option to get the ignored files. (The option is only added when ls-files were called previously.) This call did not seem to hang with many ignored files and the command runtime does not increase much.

The solution is not optional though. It still lists all ignored files in memory. The time to find ignored files is faster, but a lot of memory is needed. #4256 has some discussions.
Also, processing all output to GitStatusItem first before creating the HashSet will require some more memory (temporary) than required.

There are likely better places to optimize (and this PR reduces CPU load by skipping a separate heavy ls-files), but memory and CPU usage (normally a few ms) can be improved by skipping ignored by default in GetAllChangedFilesFromString() and process the ignored separately. I felt this would make the solution more complex and duplicate code.

It would be more efficient from memory usage (some CPU hits) to use the Git 2.15.1 option --ignored=matching, but a fallback solution (at least) is needed.

Changes proposed in this pull request:

  • Use git-status to retrieve ignored files instead of ls-files

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

  • Test that ignored files are ignored in a similar way as before

Has been tested on (remove any that don't apply):

  • GIT 2.15
  • Windows 10

@RussKie
Copy link
Member

RussKie commented Feb 1, 2018

Please update/rebase when you have time.
Thank you

@gerhardol
Copy link
Member Author

Will rebase now when #4327 is merged, the two last commits are applicable

@gerhardol gerhardol force-pushed the feature/n4256-commit-count-status-ignore branch from 7a75639 to 9f93e1d Compare February 1, 2018 21:02
@gerhardol
Copy link
Member Author

Rebased without changes.

There are likely better places to optimize (and this PR reduces CPU load by skipping a separate heavy ls-files), but memory and CPU usage (normally a few ms) can be improved by skipping ignored by default in GetAllChangedFilesFromString() and process the ignored separately. I felt this would make the solution more complex and duplicate code.

Repeating from PR description. This is the simplest way and a solution in the same way as normal GE functionality, but this is not the same as this the best way to add more info to GitItemStatus (maybe better to add ~100 lines of duplicated code).

@RussKie
Copy link
Member

RussKie commented Feb 1, 2018 via email

@RussKie
Copy link
Member

RussKie commented Feb 1, 2018 via email

@gerhardol
Copy link
Member Author

Will we need to revisit this after adding 2.15.1+ to our setup?

2.15.1 can optimize the solution, primarily minimize memory usage. But that will not require many lines of code (most is to detect Git version and to set --ignored=matching, then only ignored directories will be listed). Less memory but higher CPU usage and some corner cases will be ignored (a file that is not ignored in an ignored directory will not trigger an update, but we can live with that corner case).
I do not like to have different behavior for different Git revisions.

Not saying it is an action item, but typically if to imement something we need to duplicate code

This solution requires no duplication. Not adding IsIgnored will likely require duplication of GetAllChangedFilesFromString().

No command currently requests ignored files (if there was, they would be included with IsNew)
Issue gitextensions#4256
Listing ignored files with a separate "ls-files -o -i --exclude-standard" seem to never exit in some situations, see gitextensions#4256
This reuses the git-status call with --ignored as an option to get the ignored files. (The option is only added when ls-files were called previously.) This call did not seem to hang with many ignored files and the command runtime does not increase much.

The solution is not optional though. It still lists all ignored files in memory. The time to find ignored files is faster, but a lot of memory is needed. gitextensions#4256 has some discussions.
Also, processing all output to GitStatusItem first before creating the HashSet will require some more memory (temporary) than required.
@gerhardol gerhardol merged commit 1cc3b12 into gitextensions:master Feb 10, 2018
@RussKie RussKie removed the ready label Mar 10, 2018
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Sep 26, 2018
fixes gitextensions#5439
fixes gitextensions#4256

partly based on gitextensions#5429
The handling was improved in gitextensions#4327, gitextensions#4328, fixing the regression
Those PRs limited the max load for git-status

Changes:
React faster on changing directory (1.0s->0.2s)
Some tweaks to the checks, do not check if update is required if an update is already scheduled

Do not read ignored files due to two problems:
 * Reading ignored takes longer times. Since this was done the first time, the first update was delayed.
   (Reading ignored could be done later, but this will still delay the next update).
 * Saving all seen ignored files require substantial memory, see gitextensions#4256.
   The list could be limited (see the issue), but that will increase the test time for ignored files

As ignored files will now always trigger git-status may cause some more runs.
However, the ignored file list was never complete, the list was better over time,
so GE must be able to handle this load anyway.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Sep 26, 2018
fixes gitextensions#5439
fixes gitextensions#4256

partly based on gitextensions#5429
The handling was improved in gitextensions#4327, gitextensions#4328, fixing the regression
Those PRs limited the max load for git-status

Changes:
React faster on changing directory (1.0s->0.2s)
Some tweaks to the checks, do not check if update is required if an update is already scheduled

Do not read ignored files due to two problems:
 * Reading ignored can takes significant time. Since this was done the first time, the first update was delayed.
   (Reading ignored could be done later, but this will still delay the next update).
 * Saving all seen ignored files require substantial memory, see gitextensions#4256.
   The list could be limited (see the issue), but that will increase the test time for ignored files

As ignored files will now always trigger git-status may cause some more runs.
However, the ignored file list was never complete, the list was better over time,
so GE must be able to handle this load anyway.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Sep 27, 2018
fixes gitextensions#5439
fixes gitextensions#4256

partly based on gitextensions#5429
The handling was improved in gitextensions#4327, gitextensions#4328, fixing the regression
Those PRs limited the max load for git-status

Changes:
React faster on changing directory (1.0s->0.2s)
Some tweaks to the checks, do not check if update is required if an update is already scheduled

Do not read ignored files due to two problems:
 * Reading ignored can takes significant time. Since this was done the first time, the first update was delayed.
   (Reading ignored could be done later, but this will still delay the next update).
 * Saving all seen ignored files require substantial memory, see gitextensions#4256.
   The list could be limited (see the issue), but that will increase the test time for ignored files

As ignored files will now always trigger git-status may cause some more runs.
However, the ignored file list was never complete, the list was better over time,
so GE must be able to handle this load anyway.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Sep 30, 2018
fixes gitextensions#5439
fixes gitextensions#4256

partly based on gitextensions#5429
The handling was improved in gitextensions#4327, gitextensions#4328, fixing the regression
Those PRs limited the max load for git-status

Changes:
React faster on changing directory (1.0s->0.2s)
Some tweaks to the checks, do not check if update is required if an update is already scheduled

Do not read ignored files due to two problems:
 * Reading ignored can takes significant time. Since this was done the first time, the first update was delayed.
   (Reading ignored could be done later, but this will still delay the next update).
 * Saving all seen ignored files require substantial memory, see gitextensions#4256.
   The list could be limited (see the issue), but that will increase the test time for ignored files

As ignored files will now always trigger git-status may cause some more runs.
However, the ignored file list was never complete, the list was better over time,
so GE must be able to handle this load anyway.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Oct 3, 2018
fixes gitextensions#5439
fixes gitextensions#4256

partly based on gitextensions#5429
The handling was improved in gitextensions#4327, gitextensions#4328, fixing the regression
Those PRs limited the max load for git-status

Changes:
React faster on changing directory (1.0s->0.2s)
Some tweaks to the checks, do not check if update is required if an update is already scheduled

Do not read ignored files due to two problems:
 * Reading ignored can takes significant time. Since this was done the first time, the first update was delayed.
   (Reading ignored could be done later, but this will still delay the next update).
 * Saving all seen ignored files require substantial memory, see gitextensions#4256.
   The list could be limited (see the issue), but that will increase the test time for ignored files

As ignored files will now always trigger git-status may cause some more runs.
However, the ignored file list was never complete, the list was better over time,
so GE must be able to handle this load anyway.
gerhardol added a commit to gerhardol/gitextensions that referenced this pull request Oct 5, 2018
fixes gitextensions#5439
fixes gitextensions#4256

partly based on gitextensions#5429
The handling was improved in gitextensions#4327, gitextensions#4328, fixing the regression
Those PRs limited the max load for git-status

Changes:
React faster on changing directory (1.0s->0.2s)
Some tweaks to the checks, disable file system monitoring temporary if an update is already scheduled

Do not read ignored files due to two problems:
 * Reading ignored can takes significant time. Since this was done the first time, the first update was delayed.
   (Reading ignored could be done later, but this will still delay the next update).
 * Saving all seen ignored files require substantial memory, see gitextensions#4256.
   The list could be limited (see the issue), but that will increase the test time for ignored files

As ignored files will now always trigger git-status may cause some more runs.
However, the ignored file list was never complete, the list was better over time,
so GE must be able to handle this load anyway.
@gerhardol gerhardol deleted the feature/n4256-commit-count-status-ignore branch November 14, 2021 13:01
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