kblincoe / VisualGit_SE701_2019_4

1 stars 0 forks source link

GUI freezes with high CPU occupation when opening local repositories with long commit history and multiple references #90

Open YichenTang97 opened 5 years ago

YichenTang97 commented 5 years ago

Step To Reproduce

  1. Open the visual git and choose continue without login
  2. Select the Add Folder button in the top left (currently by default the add folder page is automaticaly showing up)
  3. Paste the path to a git repo with multiple git references (e.g. over 10) and relatively long commit histories (e,g. over 360) into the "local repository" option.
  4. Click Open button.

After a few seconds, the GUI should freeze and your CPU usage will be occupyed by multiple electron process and reach 100%. It will not recover in a few minutes.

For a repo with a single git reference, and over 600 commits, it takes over a minute for the GUI to recover from freezing.

This problem can be a performance problem caused by bad implementation. An existing issue #26 might be related to this issue.

qw commented 5 years ago

What exactly causes this issue besides the fact that it is not asynchronous? Does it try to load all of the history at once or something similar?

YichenTang97 commented 5 years ago

What exactly causes this issue besides the fact that it is not asynchronous? Does it try to load all of the history at once or something similar?

The function used to get all commit history - getAllCommits is actually asynchronous, and only takes a few seconds - this is why in the first few seconds, the GUI works fine without freezing. Real problem occurs in the callback function of it - processGraph. To be more specific, among the three methods called within the processGraph callback function, sortCommits method still completed although took a long time, however the program got trapped in makeBranchColor. I still need to look deeper into these methods to identify the exact problem.