gitui icon indicating copy to clipboard operation
gitui copied to clipboard

Improve redraw performance

Open R0nd opened this issue 4 years ago • 13 comments

This Pull Request fixes/closes #869.

It changes the following:

  • Improves redraw performance by moving sync repo operations off the UI thread

I followed the checklist:

  • [ ] I added unittests
  • [X] I ran make check without errors
  • [X] I tested the overall application
  • [X] I added an appropriate item to the changelog

R0nd avatar Oct 16 '21 18:10 R0nd

Does it make a noticeable difference? Did you do any measuring?

extrawurst avatar Oct 16 '21 18:10 extrawurst

I tried scrolling through revlog continuously, and batching up to 10 input events was enough to clear the input event congestion (for a debug build on my setup)

R0nd avatar Oct 16 '21 18:10 R0nd

I tried scrolling through revlog continuously, and batching up to 10 input events was enough to clear the input event congestion (for a debug build on my setup)

ok I was asking if you can see a noticeable difference though?

extrawurst avatar Oct 17 '21 11:10 extrawurst

I checked out your branch. I cannot see any difference in a debug build compared to a debug build from master though. do you?

extrawurst avatar Oct 17 '21 11:10 extrawurst

I've recorded screencasts do demonstrate the case - in both recordings I was holding the down arrow key until the revlog passed ~1400 commit number. The master build keeps processing the congested events long after the 1400 commit mark and the version with event batching stops scrolling just in time, showing the absence of congested events. master queue-updates

R0nd avatar Oct 17 '21 14:10 R0nd

Honestly I think the only correct solution would be to move data fetching away from the UI thread, which would make this PR unnecessary. I'm new to rust, so I'm still trying to wrap my head around concurrency vs ownership.

R0nd avatar Oct 20 '21 19:10 R0nd

Honestly I think the only correct solution would be to move data fetching away from the UI thread, which would make this PR unnecessary. I'm new to rust, so I'm still trying to wrap my head around concurrency vs ownership.

Not sure what you mean. What particular data fetching? Most expensive ones are run on a threadpool

extrawurst avatar Oct 20 '21 20:10 extrawurst

The revlog update in particular, it runs a sync::get_commits_info on the UI thread. Which is the reason of #869 in the first place.

R0nd avatar Oct 20 '21 20:10 R0nd

The revlog update in particular, it runs a sync::get_commits_info on the UI thread. Which is the reason of #869 in the first place.

well this is unlikely since this is only done once for every 1200 commits in a batch. did you measure this to be sure? if I only scroll inside the batch (so no get_commits_infocalls) it still lags. is that different in your case?

extrawurst avatar Oct 20 '21 20:10 extrawurst

You're right, I've run profiling on this case and narrowed the issue down to update_commands checking the repo state TWICE on every redraw and also getting head in CommitComponent::can_amend image Maybe these values can be cached and updated only on git events?

R0nd avatar Oct 21 '21 06:10 R0nd

Moving status updates off the UI thread seems to have worked out, redraw speed improved greatly and UI updates following repo status changes still work correctly, tested the case with "abort merge" command appearing after creating a merge commit.

R0nd avatar Oct 21 '21 20:10 R0nd

if we want to go forward with this we would need to bring it up to date with master

extrawurst avatar Aug 17 '22 16:08 extrawurst

This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 17 '24 15:03 stale[bot]