Closed
Description
vscode/extensions/ipynb/src/helpers.ts
Lines 364 to 377 in 4e5d793
Currently the stream output conversion (from VS Code types to Jupyter) does unnecessary V8 string concatenation and split, which slows down the conversion (using more memory and gc):
- Stream output is either
CellOutputMimeTypes.stderr
orCellOutputMimeTypes.stdout
, soconvertOutputMimeToJupyterOutput
will always returnstring
. Usingprev.concat(curr)
will keep creating arrays splitMultilineString(outputs.join(''))
can slow down the process significantly. It firstly joins all the string, and then split by line breaks, this will trigger v8 to flatten the concatenated string (outputs.join('')
) and double the memory usage.
We can probably run splitMultilineString
on each output and concatenate last line of each output with the first line of next output (split first, then join).