-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Slow notebook execution with eslint enabled #211142
Comments
It's faster after disabling eslint, but still slow, spending a lot of time in a handler for that event but in the python extension
|
I believe the problem is with the fact that for every cell cell we access the vscode configuration details and thats slow. I believe the same would apply here as well (insteading of passing the Cell Uri, we can use the notebook Uri as thats common to the notebook). Will try to contribute to eslint.
Please can you share the CPU profile, I didn't come across any issues with Python extension. |
Before changes to eslint After changes to eslint I.e. 10x improvement, from 22s to 2.3s . |
Todo: why is eslint even triggering when executing cells? |
@DonJayamanne I would first like to understand that as well. The code that you optimized should only be trigger when open / closing documents. Do you have easy steps for me that I can use to reproduce this. @sandy081 do you know about any performance issues with |
Not true. the As mentioned here microsoft/vscode-eslint#1837 (comment) |
I am not aware of any perf issues with config API. It is sync and we have data cached on ext host. |
@DonJayamanne thanks for the pointer. I think I understand why this is happening but fixing it in the ESLint side is IMO not the correct way to do. There could be a second extension which causes the same problems. And according to @sandy081 all the config data is cached and sync. IMO the fix needs to go into the language server client to fix this for everyone. I will look into using the test plan item to reproduce this. If I need help I will ping you. |
@DonJayamanne I was able to reproduce this. But what is strange is the fact the executing the |
@dbaeumer Yes this is expected, the changes are for the state transition when executing a cell.
& 1 more, I can't remember |
@DonJayamanne I did some more testing and I am under the impression that the number of events I get is proportional to the number of cells in the document. A notebook document with 3 code cells sends out 18 Why are these event not batch, especially since I am not saying that the code in ESLint can't be optimized. I am always for performance improvements. But executing a notebook with 500 cells shouldn't generate more events than executing a notebook document with one cell. If we can minimize the number of events all listeners for Adding @roblourens @rebornix since IMO this is nothing that can only be addressed by ESLint. Another listener or extension can cause the same performance problem without knowing. What would definitely help as well is some reason in the event, especially when the event is fired because of cell execution Then listeners could ignore some of these event without the need of inspecting their data. |
@dbaeumer thanks for digging into this and the feedbacks.!
Right, it's proportional to the cell count. It's the nature of notebooks, which are multi-documents-y, like a workspace/project.
I think we designed this in the same fashion as text document change events. Content change events are not delayed, when the core receives a change, it emits it to EH and broadcasts to all listeners. For example, when I press enter in TS file, I got four events (first event is the change, and I don't understand the other 3, maybe some format/indent/codeaction) And if I try to F2 to rename a symbol, which touches two files, I got 8 events, which is proportional to the amount of files touched. This is the same reason why executing 500 cells emit 500*N events, as cells run in sequence, and we don't have any "debouncing" for the events. With that said, @DonJayamanne and I discussed about if we can debounce the events, but that's a breaking behavior change and I'm also concerned that it might lead to unexpected issues for extensions.
This is a really great idea and I think we should add |
I thought about it a little more but I am still a little afraid about the number of events, especially I don't see what a extension should do with all of them. I debugged the events with a notebook with one cell so my statements might be incorrect. And I discovered the following things:
I have attached the debugger output of all six events. And sorry for bothering you with that but the less events we sent the less damage badly written extensions can cause. |
Issue that would help with the events #212063 |
I think we’ve addressed all the issues in waking and core |
Testing #210963
Spends a lot of time in the eslint extension... Did something change with the
didChangeNotebookDocument
event?vscode-profile-2024-04-23-10-33-17.cpuprofile.zip
The text was updated successfully, but these errors were encountered: