-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Reduce pressure on editor when opening very large files #169288
Conversation
@microsoft-github-policy-service agree |
85ddc80
to
3f1c904
Compare
This is a good initiative and I certainly see that when opening a very large file, e.g. right on startup with other files in other groups visible:
I am however a little bit worried about the complexity of the change so would need more time understanding it and seeing if it causes regressions. To be honest, I am not a big fan of the new I think the gist of this change and what makes it perform better is that today we pump the entire file contents into the stream which can slowdown the consumer and with this change we go back to disk and read chunks of 10MB, which slows down the reading but reduces the pressure on the consumer (the window). I would be awesome if we could somehow leverage the vscode/src/vs/base/common/stream.ts Lines 248 to 267 in 12d5673
We have our own simple stream implementation and it is certainly possible that our implementation misses the pieces to do this properly but in a nutshell it would be nice if the consumer of the stream could signal that it only accepts N chunks of data and the provider of the stream refrains from sending more data until processed. The possible downside of this approach is that the provider will see its buffers fill until the consumer processes it, so maybe after all we need the solution where we read chunks from disk but it would be great if this could be done behind the scenes automatically for large files and not from the text file service. |
Briefly looked into this further, turns out we already do position based reading in the main process, which is what eventually the methods will reach to: vscode/src/vs/platform/files/common/io.ts Line 81 in 9e8d780
Here we read a chunk of 256kb data from disk to emit into a stream that eventually travels in the renderer process. If we were to add some yielding here, we can free up some pressure, but it comes at the cost of slower loading of large files... |
7c0a3c3
to
fbe9156
Compare
hi, I changed the code, delete the |
Any update on this issue? We also need to perform better in vscode-web compared to local-vscode for the large file reading. |
This pr is not very good. so just close it first. |
I see #167719.
When I use vscode to open a large file( maybe about 500MB, the text content , some server log ), the editor is pending, I can't do other operations.
bad experience expecially in the web cloud ide (the remote development)
I think some different way to do with the large file, may be better