Skip to content

Conversation

@GdoongMathew
Copy link
Contributor

@GdoongMathew GdoongMathew commented Oct 28, 2025

What does this PR do?

Attempt to fix #13937

Benchmark Results are as below

master
    === Benchmark Results ===
    Version      No Rich (s)    With Rich (s)
    ---------  -------------  ---------------
    2.6.0.dev          7.945           13.089

master auto-refresh enabled, 33 updates / second
    === Benchmark Results ===
    Version      No Rich (s)    With Rich (s)
    ---------  -------------  ---------------
    2.6.0.dev          7.605             7.09

this branch
    === Benchmark Results ===
    Version      No Rich (s)    With Rich (s)
    ---------  -------------  ---------------
    2.6.0.dev          7.676            8.345

Key changes:

  1. Conditional refresh
    CustomProgress.refresh now only calls its superclass method when running in interactive mode. This change is critical for performance since in most cases, we only need to notify the refresh thread rather than performing a full refresh.
  2. No threading.Event for custom _RefreshThread
    Using Event would introduce unnecessary locking overhead. Since acquiring and releasing locks are relatively expensive here, this approach didn’t yield any speed improvement.
  3. Auto-refresh side effects
    Simply enabling auto_refresh would revert Add refresh_rate to RichProgressBar #10497 and bring back pdb - based debugging with RichProgressBar doesn't show input #10607, which causes pdb unusable when using RichProgressBar.

TBH, I’m not entirely sure if this is the best solution, but I haven’t found another way to improve performance without undoing prior fixes.
Given that we’re now defaulting to rich-based progress bars and model summaries when rich is installed, I think this could still be quite a beneficial improvement — happy to hear thoughts or alternative ideas.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

Reviewer checklist
  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

📚 Documentation preview 📚: https://pytorch-lightning--21321.org.readthedocs.build/en/21321/

@github-actions github-actions bot added the pl Generic label for PyTorch Lightning package label Oct 28, 2025
@GdoongMathew GdoongMathew changed the title Custom rich refresh thread Improve RichProgreasBar speed performance Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pl Generic label for PyTorch Lightning package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RichProgressBar in v1.6 is slower than v1.5

1 participant