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

Only tick if the ticker is disabled #458

Merged
merged 2 commits into from Aug 3, 2022
Merged

Only tick if the ticker is disabled #458

merged 2 commits into from Aug 3, 2022

Conversation

djc
Copy link
Collaborator

@djc djc commented Aug 3, 2022

Fix a regression from #417 to fix #457.

Of the 4 callers of BarState::tick(), changed three to no longer tick if the ticker is enabled:

  • ProgressBar::inc()
  • ProgressBar::set_position()
  • ProgressBar::update()

The fourth is ProgressBar::tick(), which already only ticked if the ticker was disabled.

@@ -339,7 +339,7 @@ fn ticker_drop() {
.with_finish(ProgressFinish::AndLeave)
.with_message(format!("doing stuff {}", i)),
);
new_spinner.enable_steady_tick(Duration::from_millis(50));
new_spinner.enable_steady_tick(Duration::from_millis(100));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was a test failure on Windows only, so I'm guessing that's just a timing artefact?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think so

@djc
Copy link
Collaborator Author

djc commented Aug 3, 2022

Seems like the performance impact here is negligible (based on running cargo run --release --example fastbar), although it's a little ugly that we have to lock another mutex.

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.

Spinner running faster than "steady tick" duration in v0.17
2 participants