-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Avoid unnecessary string join and split #129370
Comments
vscode/extensions/ipynb/src/helpers.ts Line 171 in 4e5d793
Do we also want to split |
This way would preserve the |
Discussed with @DonJayamanne, he plans to update this during debt week |
I agree, we can just look at the string immediately after the first {
cell:.... Thus all we need to know is the white space between the first |
Tbh I don't remember talking about this @DonJayamanne, but are you planning on looking into this? I also can. The
What does the indentation detection library do beyond that? This sounds fine to me. |
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):
CellOutputMimeTypes.stderr
orCellOutputMimeTypes.stdout
, soconvertOutputMimeToJupyterOutput
will always returnstring
. Usingprev.concat(curr)
will keep creating arrayssplitMultilineString(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).The text was updated successfully, but these errors were encountered: