Transfer notebook output as VSBuffer (#130452)

* Transfer notebook output data as a VSBuffer

This PR transfers notebook output as an VSBuffer instead of as a array of numbers. This significantly reduces the message size as well as the serialize/deserialize times

To accomplish this, I've introduced a new `SerializableObjectWithBuffers` type. This specially marks rpc objects that contain VSBuffers. This is needed as our current RPC implementation can only efficently transfer VSBuffers that appears as top level arguments. The rpcProtocol now can also identify top level `SerializableObjectWithBuffers` arguments and ensure these are serialized more efficently.

This is easier than trying to extract the `VSBuffer` proeprties to top level arguments. It also lets us easily support return types that may contain buffers

* use SerializableObjectWithBuffers when dealing with (old) notebook controllers

Co-authored-by: Johannes Rieken <johannes.rieken@gmail.com>
This commit is contained in:
Matt Bierner
2021-08-17 09:57:57 -07:00
committed by GitHub
parent 99cd300af4
commit 8b6547aa2c
31 changed files with 378 additions and 187 deletions

View File

@@ -21,6 +21,7 @@ import { NotebookCellOutput } from 'vs/workbench/api/common/extHostTypes';
import { asWebviewUri } from 'vs/workbench/api/common/shared/webview';
import { CellExecutionUpdateType } from 'vs/workbench/contrib/notebook/common/notebookExecutionService';
import { checkProposedApiEnabled } from 'vs/workbench/services/extensions/common/extensions';
import { SerializableObjectWithBuffers } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import * as vscode from 'vscode';
interface IKernelData {
@@ -362,7 +363,7 @@ class NotebookCellExecutionTask extends Disposable {
private async update(update: ICellExecuteUpdateDto | ICellExecuteUpdateDto[]): Promise<void> {
const updates = Array.isArray(update) ? update : [update];
return this._proxy.$updateExecutions(updates);
return this._proxy.$updateExecutions(new SerializableObjectWithBuffers(updates));
}
private verifyStateForOutput() {