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

Fix performance of progress bar in Git fetch #5058

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Conversation

martinvonz
Copy link
Member

@Ralith, can you take a look and see if this preserves the behavior you intended?

Closes #5057.

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

@martinvonz martinvonz force-pushed the push-lkrquxkrzuqm branch 2 times, most recently from 67fe8e0 to 997aa48 Compare December 9, 2024 08:18
@martinvonz martinvonz changed the title Push lkrquxkrzuqm Fix performance of progress bar in Git fetch Dec 9, 2024
Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine. I guess the issue here is that sometimes it takes much longer than INITIAL_DELAY for us to start receiving updates, particularly when cloning huge repos?

cli/src/progress.rs Outdated Show resolved Hide resolved
@martinvonz
Copy link
Member Author

I guess the issue here is that sometimes it takes much longer than INITIAL_DELAY for us to start receiving updates, particularly when cloning huge repos?

No, the issue in the existing code is that the self.next_print = now.min(...); is effectively self.next_print = now;, so we end up waiting the initial delay and then we never wait again (i.e. we print every update).

@Ralith
Copy link
Collaborator

Ralith commented Dec 9, 2024

Oh, wow, no idea what I(?) was thinking there. Nice catch.

cli/src/progress.rs Outdated Show resolved Hide resolved
The progress bar is supposed to update only 30 times per second, but
as was reported in #5057, that doesn't seem to be what's
happening. This patch adds tests showing how we update the progress
bar for every event.
I think the idea of the code was try do 30 updates per second even if
events arrive at, say, every 20 milliseconds. If we had reset the
timer every time we printed, we would otherwise reset the timer every
40 milliseconds and end up with 25 updates per second. However, a bug
in the code caused it to print every update because it always set the
threshold to print the next update to `now`. I tried to keep what I
think was the intent of the original code while fixing the bug.
@martinvonz martinvonz merged commit 27c2882 into main Dec 10, 2024
31 checks passed
@martinvonz martinvonz deleted the push-lkrquxkrzuqm branch December 10, 2024 01:08
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.

The progress bar causes massive traffic and high CPU usage to the terminal running jj
3 participants