gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Multithreading in diff calculation

Open roderik opened this issue 6 months ago • 1 comments

wrt https://discord.com/channels/1060193121130000425/1073202153163857920/1203599833236119552

I changed a 39MB ts file (generated obviously) and the entire UI stopped working.

  • no new changes showed up
  • after restart a never ending spinner
  • 1 cpu core at 100%
  • nothing in the logs

I had to recover by stashing from old school git and applying the changes back in a regular branch. Deleting the integration branch and restarting.

Outside observation: the diff calculation is single threaded and running on an M3 efficiency core. Making this multithreaded would significantly speed this up (at least on my machine)

roderik avatar Feb 04 '24 07:02 roderik

We'll look into the UI lockup.

re: threading, currently we use libgit2 for diff calculation, which I do not believe can be multithreaded, but at some point we'll want to reimplement this most likely. We could switch to core git but I don't think git diff takes advantage of multiple threads either.

We do want to rewrite this though, so we can take advantage of the fsmonitor events to track status fast, rather than do a new diff every time.

schacon avatar Feb 05 '24 13:02 schacon

I believe this particular issue has been fixed since a few releases ago, so I am closing this. There are a few other performance issues that are tracked in other gh issues (tagged with performance).

@roderik if you hit this issue again, feel free to ping me or open another issue.

krlvi avatar Mar 15 '24 22:03 krlvi