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
Speed up transfer of outputs to notebook webviews #178719
Conversation
For microsoft/vscode-jupyter#11031 The VS Buffer for the output items has a short byte length but a very large backing buffer (`Uint8Array` which is actually a `Buffer`) When sending outputs to the webview, we ended up transfering the huge backing buffer instead of the much smaller actual data We can fix this by creating a Uint8Array copy of the data and then transfering it to the webview
// which improves IPC performance and therefore should be used. However, it does | ||
// means that the bytes cannot be used here anymore | ||
|
||
// Copy the underlying buffer so we only send over the data we need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we send notebook model dto from EH to Renderer, we merged all buffers into one vscode/src/vs/workbench/services/extensions/common/rpcProtocol.ts Lines 857 to 875 in b9202b6
I think that's how we end up with multiple buffers sharing the same |
Thanks @rebornix. This may be the best fix then. Longer term, we could explore using a |
I'll merge this first to ensure users don't have OOM with images. We should look into this and see if we can avoid the duplication of buffers. |
For microsoft/vscode-jupyter#11031
The VS Buffer for the output items has a short byte length but a very large backing buffer (
Uint8Array
which is actually aBuffer
)When sending outputs to the webview, we ended up transfering the huge backing buffer instead of the much smaller actual data
We can fix this by creating a Uint8Array copy of the data and then transfering it to the webview