sboulema / TGit

Control TortoiseGit from within Visual Studio
MIT License
31 stars 9 forks source link

GitFlowFinishHotfixCommand.BeforeQueryStatus causing Visual Studio responsiveness issues #73

Closed davkean closed 2 years ago

davkean commented 2 years ago

I'm from the Visual Studio performance team and our telemetry analysis is showing that TGit is causing Visual Studio responsiveness. Over the past 21 days, GitFlowFinishHotfixCommand.BeforeQueryStatus has the following hits (this is sampled at 10% of users):

Root Leaf Expressed Hits Total Hits Duration (75th Percentile) Delayed Mouse Clicks Delayed Key Strokes
tgit.dll!SamirBoulema.TGit.Commands.GitFlowFinishHotfixCommand.BeforeQueryStatus tgit.dll!SamirBoulema.TGit.Helpers.ProcessHelper+d__.MoveNext 1,263 19,780 1.74 sec 824 478

Total hits represents the number of times this code froze the UI, whereas expressed hits, represents the number of times this code froze the UI and interrupted user mouse clicks and key strokes.

Looking at the stacks, and from code inspection, the problem is that GitFlowFinishHotfixCommand.BeforeQueryStatus is calling 3 processes within a path that is expected to be very short (under 10ms). In the wild, this has a 75th percentile of 1.75 seconds, but sometimes taking up to 20 seconds. Some users hit this delay 10s of times within a single Visual Studio session, with at least 3 users hitting this over hundred times in one session.

davkean commented 2 years ago

It also looks like GitFlowFinishReleaseCommand is in the same situation.

sboulema commented 2 years ago

Hello David,

I feel somewhat honored and ashamed at the same time that my extension has shown up on your radar. The new release going out now, has these functions changed. I hope this will solve the performance issue for now.

Might I be so bold and ask a question... What those functions were doing is checking if a user is on the correct git branch to perform a certain action. Is their a better more performant way of detecting a branch switch in visual studio? Is their an event I can hook into?

Thanks in advance!

Samir