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

Updates to Notebook Cell output causes abrupt flashing/flickering in notebooks and interactive window #132143

Closed
joyceerhl opened this issue Aug 31, 2021 · 10 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders interactive-window verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@joyceerhl
Copy link
Collaborator

  1. python -m pip install livelossplot
  2. Run this code https://github.com/microsoft/vscode-jupyter/blob/b4a3e1d13446c27b0bedf66272b08f5e13ace57f/src/test/datascience/liveloss.py
  3. Observe some jarring flashing behavior as the plot updates

recording (20)

The visual effect is exacerbated for interactive window because auto scrolling is done in VS Code core, but the issue is also present for notebooks (abrupt flashing as the plot disappears and gets recreated)

recording (21)

In classic Jupyter there's no such flashing. The output updates are smooth:

recording (22)

@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-jupyter Sep 2, 2021
@DonJayamanne DonJayamanne changed the title Livelossplot output rerendering causes abrupt flashing/flickering in notebooks and interactive window Updates to Notebook Cell output causes abrupt flashing/flickering in notebooks and interactive window Sep 2, 2021
@DonJayamanne
Copy link
Contributor

Also reported here #132143

Old behavior (no flashes, in webview interactive & webview notebooks)

noflash

New behavior
(Note: as this is a gif, the flickering isn't as noticeable).
flash

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Sep 2, 2021

@DonJayamanne @joyceerhl when you transfer issues, would you mind assigning them to the right person if you know who that is?

@rebornix rebornix added interactive-window bug Issue identified by VS Code Team member as probable bug labels Sep 15, 2021
@rebornix rebornix added this to the September 2021 milestone Sep 15, 2021
@DonJayamanne
Copy link
Contributor

I can still repro this with the same code for the progress bar.

@DonJayamanne DonJayamanne reopened this Sep 30, 2021
@rebornix
Copy link
Member

rebornix commented Oct 1, 2021

The progress bar might be a different case, @DonJayamanne can you share the code?

@rebornix rebornix modified the milestones: September 2021, October 2021 Oct 1, 2021
@DonJayamanne
Copy link
Contributor

DonJayamanne commented Oct 1, 2021

Install dependencies

%pip install fastprogress

Cell 2

from fastprogress.fastprogress import master_bar, progress_bar
from time import sleep
mb = master_bar(range(10))
for i in mb:
    for j in progress_bar(range(100), parent=mb):
        sleep(0.01)
        mb.child.comment = f'second bar stat'
    mb.main_bar.comment = f'first bar stat'
    mb.write(f'Finished loop {i}.')

@rebornix rebornix modified the milestones: October 2021, On Deck Oct 27, 2021
@rebornix
Copy link
Member

rebornix commented Nov 3, 2021

Spent the whole afternoon digging into this and finally found the root cause: the flash is caused by overflow: hidden. Right now there is no primitive for "replace output" in the webview layer so we will always perform a remove and then add DOM operation. The remove will make the height of the container to be zero and since it has overflow: hidden, we are not going to see anything inside the output container. The next add enlarges the container and becomes visible. Somehow the browser doesn't optimize for this case and always "flashes".

The overflow: hidden was added to ensure that we see minimal overlap of outputs and code editors. Apparently it comes with a cost ;)

@dd-trafo
Copy link

@rebornix Any progress on this issue? Progress bars like that of @DonJayamanne cause a strobe-like flickering due to constant redraws.

@dd-trafo
Copy link

@gyohng
Copy link

gyohng commented Nov 4, 2022

Affects me as well.

@vscodenpa vscodenpa added unreleased Patch has not yet been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jan 10, 2023
@vscodenpa vscodenpa added the insiders-released Patch has been released in VS Code Insiders label Jan 11, 2023
@rzhao271 rzhao271 modified the milestones: On Deck, January 2023 Jan 23, 2023
@rebornix rebornix added the verification-needed Verification of issue is requested label Jan 24, 2023
@rebornix
Copy link
Member

Verifier, please test when you are rerunning cells with outputs, the cell doesn't shrink too early, you can test this with following code

print('hello')
print('world')

@joyceerhl joyceerhl added the verified Verification succeeded label Jan 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug insiders-released Patch has been released in VS Code Insiders interactive-window verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants