Closed loftusa closed 7 months ago
I reinstall the Pylance, it is still fast, at least up to now. I installed the jupyter pre-release(version:2024.4.2024041101). The vscode is not insiders (version 1.88.1). By fast, I mean when executing, it directly goes without waiting for several seconds. I also try to reinstall the copilot and it's delaying again.... I guess the copilot should be the reason.
@ydastro for Copilot are you referring to GitHub.copilot
or GitHub.copilot-chat
in particular?
@ydastro for Copilot are you referring to
GitHub.copilot
orGitHub.copilot-chat
in particular?
I refer to the GitHub.copilot.
It used to be the case that clearing the interactive window would restore performance, but now it seems like slowness accumulates over time even when the interactive window has been cleared --- this is so much worse than the non-pre-release/non-insider-preview state!
Clicking "Clear all" should be instantaneous, it should not take multiple seconds after clicking "run cell" to have the text show up in the interactive window, and it should not take 5+ seconds to start running the code.
Profiling the clear all -> shift+enter -> wait for running to complete: CPU-20240426T060412.680Z.cpuprofile.txt
$ code-insiders --status
Here is the performance monitor of the relevant time slice, but how do I save it?
I was not able to capture any additional profiles, yet, since reloading the window reset the performance. Is there something else I should be profiling though?
@JasonGross
it should not take multiple seconds after clicking "run cell" to have the text show up in the interactive window, and it should not take 5+ seconds to start running the code. this is so much worse than the non-pre-release/non-insider-preview state!
Are you saying that this is fast in VS Code insiders, and slow in VS Code Stable? If you have tested this in VS Code insiders and have disabled all extensions except for Jupyter + Python and Notebook renderers, then we know the issue has either been resolved or its with another extension. If its in another extension , please use extension bisect to determine the extension thats causing this issue (unlikely thought).
am I reading this right that most of the time is not spent in extensions?
Yes, it looks like the extensions are fine, at least from the logs Please confirm you captured the lots while you were running the test scenario.
to capture any additional profiles, yet, since reloading the window reset the performance. Is there something else I should be profiling though?
Please try the following:
Performance
tab (the tabs are on the top, Elements, Console, Sources, Network, Perforamnce
Performance
, ensure you un-tick the Screenshots
itemRecord
button on the far left Performance
tab and stop recordingSummary
tab and next to that you will see Bottom-Up
, click that tab
This tab is around 1/2 way down the screen
Sort the Self Time
in ascending order and share a screenshot of the table.
I'd like to see the items in the table in asc order.Total Time
column in asc order and share a screenshot of the sorted table again
Please snure the activity column along with the file names and paths are included.Unfortunately saving the logs is broken in VS Code, hence we will have to resort to capturing screenshots. Thank you very much for your help, I'm sure we can get to the bottom of this.
Below is a screenshot (for reference) of the Performance
tab (see towards the top) and the Bottom-Up
tab towards the middle.
This shows the getOutlineEntries
being one of the slower parts of the code path, and this has been resolved, in the latest version of VS Code insiders.
Slightly different issue, shift+enter on some code in the interactive window takes a second or two before it starts running the code. (This time if I clear the interactive window first, it becomes instantaneous; there are a bunch of plots hidden above where I'm scrolled to.)
CPU-20240426T065336.682Z.cpuprofile.txt
$ code-insiders --status
Here is the performance recording from this one: the bad (slow) behavior starts at just over 2 seconds in, and persists until just before the end.
I'm a bit confused why even for leaves the self time does not equal total time?
Are you saying that this is fast in VS Code insiders, and slow in VS Code Stable?
No, it is slow in VS Code Insiders, fast in VS Code Stable.
If you have tested this in VS Code insiders and have disabled all extensions except for Jupyter + Python and Notebook renderers, then we know the issue has either been resolved or its with another extension.
I did not disable extensions, but it should be fine because the extension profile says that no time is spent in extensions other than ssh, right?
Please confirm you captured the lots while you were running the test scenario.
Yes, captures were performed while recreating the events shown in the gif.
I have captured a profile from repeating the test in https://github.com/microsoft/vscode-jupyter/issues/14459#issuecomment-2078814363 a handful of times, over the course of 60 seconds. However, the performance capture seems to be broken, there are no details provided
No, it is slow in VS Code Insiders, fast in VS Code Stable.
What is slow, editing, executing notebooks? Have you disabled all extensions and tried again. We found esline, copilot, eslint and a few other extensions can slow things down.
Please can you try this with the following extension
Install from VSIX
Dummy Execution
Dummy Execution: run all (text output)
Dummy execution
I have captured a profile from repeating the test in #14459 (comment) a handful of times, over the course of 60 seconds. However, the performance capture seems to be broken, there are no details provided
Okay, I did it for only 40s instead of 60s, here's more captures:
I hope you find this more informative than I do. But I can't help but think that this profile doesn't contain the relevant information---I'm waiting 40 seconds for an operation that should only take 4 seconds (or less), and yet this profile only claims to capture 1256ms/.266 = 4.7 seconds. Where are the other 35s spent?
What is slow, editing, executing notebooks?
Executing.
I have given up on using .ipynb
notebooks because they are too slow and the performance is too hard to localize. Here I am reporting on the performance issues only for clicking "run cell" in .py
files treated as jupyter notebooks (with # %%
) and for entering code in the Interactive - ***.py
bar and evaluating that.
The problem is that while text is dumped into the interactive window immediately, VS Code spends an excessive amount of time (sometimes upwards of 5 seconds for one-liners like [k for k in latex_figures.keys() if "SVD" in k]
) with cells in the state.
You can see the behavior in the gifs I've uploaded.
Have you disabled all extensions and tried again.
No, I haven't done this. I'll do this next. But why does the CPU profile show that no time is spent in extensions?
I've disabled all extensions except jupyter, python, remote ssh, and wsl
I've established that the problem persists even when I've disabled all extensions except for the ones shown above.
Oh no, I'm so sorry, please can you sort the table is descending order, How could I maker they mistake
Luckily I still have it open, I can resort. I don't suppose there's a quick way to automatically expand everything above 100ms?
Also, I think there must be a bug in the profiling code, there's an instance where the total time of a parent node is less than half the total time of it's only child. What might cause this?
Pleaser can you take a screen recording. Use gifcap.dev
I will try to find a way to get the logs from you I will get back next week with some instructions
Sorry it took so long, the autoscrolling screen capture kept crashing. Apparently it's too much for a single image.
Hm, it seems to have the performance issue occasionally even with all extensions disabled, but has the performance issue way more reliably with copilot enabled. Is it possible that copilot is blocking cell execution on sending relevant data to ChatGPT or something, but this somehow doesn't show up in any profile because the time is spent in low-level system calls or something? Is there a way to debug this?
Highlighting this in case it got lost:
But I can't help but think that this profile doesn't contain the relevant information---I'm waiting 40 seconds for an operation that should only take 4 seconds (or less), and yet this profile only claims to capture 1256ms/.266 = 4.7 seconds. Where are the other 35s spent?
@DonJayamanne do you have any idea what would cause almost 90% of the time to not show up in the profile at all?
@DonJayamanne So disabling Copilot and changing to the newest version of VSCode Insiders has removed the issues for me. So it seems that Copilot was the main culprit. However, I do remember having the same issues even without Copilot last week (also using Insiders). I will upload another performance report if the problem comes back.
For now, thanks a ton for all the help and work!
I've had the same issues as others. I'm working with a particularly large dataset (50 GB in RAM). Turning on Github Copilot completions makes it take >60 seconds to start to run a cell; if I turn off completions, there is no delay at all. I'm running VS Code stable (not insiders) with pylance installed and running. Definitely seems like a Copilot issue (for me at least).
@tlkaufmann @Liam3851 That's great news, great because we've been able to identify the cause and there's a work around. We will work with copilot to get this resolved
Is the issue that Jupyter (or VSCode) is exposing some sort of blocking hook on cell execution / send text to the interactive window, Copilot takes advantage of this hook to process the entirety of the notebook / interactive window with an LLM, and blocks the execution of the code until it gets a response?
(Also, did "Clear All" become less destructive in the insider's preview / pre-release version of Jupyter? Is Copilot somehow getting access to all the cells that have been executed, even the cleared ones?)
@tlkaufmann @Liam3851 That's great news, great because we've been able to identify the cause and there's a work around. We will work with copilot to get this resolved
Can also confirm, disabling Copilot entirely (autocompletion setting didnt make faster on its own) was the answer to much faster performance including shift-enter, decreased lag when entering text, and much faster built-in autocompletions. When/How will we know when the copilot workaround has been resolved?
Remote Configuration: MacOS - remotessh - Linux machine
(2 theme extensions excluded)
I'm facing the same issue and I don't even use copilot (haven't installed it). it usually happens when I have a bunch of audio files playing inside the notebook (I train TTS).
@SoshyHayami Please can you file a separate issue for that, and please can you provide a sample notebook with all of the necessary dependencies to repro the issue (perhaps a requirements.txt or conda yml file to setup the python envirolnment). Also if there are any audio or other files, please do attach those as well.
This issue also seems to occur with Microsoft's IntelliCode, so it seems like it might be common to LLM-based code completion extensions
I'm using neither IntelliCode nor copilot, but I do use codeium, so perhaps @JasonGross is on the right track here
This issue also seems to occur with Microsoft's IntelliCode, so it seems like it might be common to LLM-based code completion extensions
@JasonGross Do you mean that performance is back to normal when IntelliCode is disabled?
For the copilot relevant issues, we are working with Copilot team for a fix and will keep you posted.
I'm going to close this issue since we've taken care of two of the major causes of poor performance and this thread has gotten really long and difficult to navigate. Please use a more specific issue for any other performance issues or file a separate issue with the specific poor performance patterns that you are experiencing.
CPU profiles are usually very helpful if it is something new: https://github.com/microsoft/vscode/wiki/Performance-Issues#profile-the-running-extensions https://github.com/microsoft/vscode/wiki/Performance-Issues#profiling-the-renderer-process
We'll use https://github.com/microsoft/vscode/issues/211154 to track the issue with copilot from our end. https://github.com/microsoft/vscode/issues/211730 is tracking improving the save performance for large files.
A big thanks to everyone that helped gather diagnostics and help narrow down the issues!
Every few months I try to use vscode for jupyter because I would really love to just use vscode for everything. Every few months, I am disappointed and switch back to the web version.
There are two reasons for this:
1) Jupyter for vscode continues, stubbornly, to essentially always be more slow than traditional jupyter lab on localhost. Look at the run times in this screenshot. It took me a minute to run imports; when I ran the exact same code on the localhost version, it took 7.7 seconds (pictures attached). This is an extremely consistent theme in vscode jupyter. Cells will sometimes randomly take minutes to run, and will sometimes not even run at all until you press 'shift-enter' on them twice. This has been true for me across multiple computers, in many different dev environments.
Cells also just randomly take forever to run, for god knows what reason. Here is a screenshot of assigning a string to a variable taking 27.4 seconds:
Note that I am not trying to blame the team here, I am just frustrated because this is so close to being a great product, but this one thing holds it back, and it keeps not being fixed for years on end. The very first thing I would do as a product manager if I were in charge of vscode-jupyter is to pause all current tasks and plan, with the team, a multiple-month effort to speed things up, and get cells to run effectively instantly (or as close to the amount of time the python processing of the code takes as possible), every time.
2) Jupyter for vscode sucks at inline documentation, the equivalent of
shift+tab
in vscode jupyter. I am aware of the existence of thetrigger parameter hints
andshow hover
settings in the keyboard shortcuts. These are extremely unreliable, and actually show documentation when I press the button maybe 1/5 of the time. When they do show documentation, there is a 'loading' tag for awhile. Browser jupyter, on the other hand, is immediate with this. Basically every time. Below is an example.The other issue with inline documentation is that, as far as I can tell, hover documentation for methods on instantiated variables simply doesn't work. When I am using
pandas
, for instance, typingdf.unique(
and then pressing theshow hover
hotkey while my typing carat is to the right of the parenthesis pops up a documentation window saying exactly nothing. In contrast, in the web version, typing the same thing produces full documentation, as expected.I don't understand how these two issues aren't your guys's top priority. Everyone I've spoken to who uses jupyter has had exactly the same experience as I have, and everyone I've spoken to who uses jupyter uses the web version exclusively for exactly these issues. Even Kaggle notebooks are better. I love copilot and it'd be great to bring it into my jupyter notebook experience, but it has just never been viable to switch if I don't want a workflow where I have to wait for 30 seconds every time I press
command-enter
, or I am frustratingly making a new cell above the current one and typingfunction?
just to see documentation.These issues have been ongoing since vscode jupyter started. They are the only things holding me and everyone else I've spoken to back from using it. Without fixing these issues, the whole thing is unusable, and no other features you guys put in matter. Why are you guys working on anything besides this when they are the only things anyone I know cares about?
I should note that this is all running in a docker container with access to 7 of my 8 cpus and 10gb of RAM. I am on a 2022 macbook air. I realize that this is a rant, so thank you for reading it. Nothing personal, I just think this product has a bunch of potential and I hate to see it unusable for so long.