Skip to content

Poor/pathological multi-cursor performance #234513

Open
@ahamid

Description

Type: Performance Issue

Using Windows-Alt-down shortcut (Command-Option?) on Mac to extend multi-cursor, after a dozen or so lines vs code totally freezes and must be killed (dialog prompts to reopen window), even though cursor limit is in the thousands (like, 10000).

Debugging, it seems that vs/editor/common/cursor/cursorMoveCommands.ts addCursorDown is generating duplicate cursors for each existing cursor for each down command. E.g. 1 -> 2 -> 4 -> 8 -> 16...after extending down to 4 cursors. I imagine this is easily reaching the cursor limit. It makes performing simple edits (delete indents) for more than just a handful of lines impossible.

public static addCursorDown(viewModel: IViewModel, cursors: CursorState[], useLogicalLine: boolean): PartialCursorState[] {

public static addCursorDown(viewModel: IViewModel, cursors: CursorState[], useLogicalLine: boolean): PartialCursorState[] {
		const result: PartialCursorState[] = [];
		let resultLen = 0;
                 // multiple duplicate cursors added for each action?
		for (let i = 0, len = cursors.length; i < len; i++) {
			const cursor = cursors[i];
			result[resultLen++] = new CursorState(cursor.modelState, cursor.viewState);
			if (useLogicalLine) {
				result[resultLen++] = CursorState.fromModelState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel.model, cursor.modelState));
			} else {
				result[resultLen++] = CursorState.fromViewState(MoveOperations.translateDown(viewModel.cursorConfig, viewModel, cursor.viewState));
			}
		}
		return result;
	}

Image

Image

Image

(the leaf calls here are to function removeChild)

VS Code version: Code 1.95.3 (Universal) (f1a4fb1, 2024-11-13T14:50:04.152Z)
OS version: Darwin x64 23.4.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 3, 3, 4
Memory (System) 32.00GB (1.84GB free)
Process Argv --crash-reporter-id 129e9867-ec36-439b-a1f1-7c366a524771
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    7	   197	 22632	code main
    0	    66	 22635	   gpu-process
    0	    33	 22636	   utility-network-service
    0	   492	 22638	window [1] (realm.ts — web)
    0	   131	 22900	shared-process
    0	     0	 23751	     /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0	    66	 22901	fileWatcher [1]
    0	   295	 23481	extensionHost [1]
    0	    98	 23604	     electron-nodejs (tsserver.js )
    0	   164	 23605	     electron-nodejs (tsserver.js )
    0	    66	 23608	       electron-nodejs (typingsInstaller.js typesMap.js )
    0	   131	 23606	     electron-nodejs (server.js )
    0	    66	 23642	     electron-nodejs (languageserver.js )
    0	    66	 23643	     electron-nodejs (languageserver.js )
    0	   131	 23645	     electron-nodejs (index.js )
    0	    33	 23656	     /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=23481
    0	   131	 23679	     electron-nodejs (eslintServer.js )
    0	   131	 23724	     electron-nodejs (main-bundle.js )
Workspace Info
|  Window (realm.ts — web)
|    Folder (web): 13737 files
|      File types: json(4490) txt(2175) js(514) ts(404) properties(248)
|                  png(220) svg(200) dmg(180) map(179) sql(171)
|      Conf files: dockerfile(41) package.json(31) tsconfig.json(17)
|                  makefile(6) settings.json(4) launch.json(1)
|                  gulp.js(1)
|      Launch Configs: pwa-node(4);
Extensions (49)
Extension Author (truncated) Version
rust-bundle 1Yi 1.0.0
Bookmarks ale 13.5.0
tsl-problem-matcher amo 0.6.2
atlascode atl 3.0.13
markdown-mermaid bie 1.27.0
vscode-svgviewer css 2.0.0
vscode-eslint dba 3.0.10
javascript-ejs-support Dig 1.3.3
rust-syntax dus 0.6.1
gitlens eam 16.0.3
shell-format fox 7.2.5
gitlab-workflow Git 5.18.1
vscode-graphql Gra 0.12.1
vscode-graphql-execution Gra 0.3.1
vscode-graphql-syntax Gra 1.3.8
vscode-mocha-test-adapter hbe 2.14.1
vscode-test-explorer hbe 2.22.1
rainbow-csv mec 3.13.0
vscode-docker ms- 1.29.3
debugpy ms- 2024.12.0
isort ms- 2023.10.1
python ms- 2024.20.0
vscode-pylance ms- 2024.11.3
jupyter ms- 2024.10.0
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
remote-ssh ms- 0.115.1
remote-ssh-edit ms- 0.87.0
live-server ms- 0.4.15
makefile-tools ms- 0.11.13
remote-explorer ms- 0.4.3
test-adapter-converter ms- 0.2.1
vscode-js-profile-flame ms- 1.0.9
sqltools mtx 0.28.3
sqltools-driver-pg mtx 0.5.4
java red 1.36.0
vscode-xml red 0.27.1
vscode-yaml red 1.15.0
vscode-coverage-gutters rya 2.12.0
semanticdiff sem 0.9.0
intellicode-api-usage-examples Vis 0.2.9
vscodeintellicode Vis 1.3.2
vscode-gradle vsc 3.16.4
vscode-java-debug vsc 0.58.1
vscode-java-dependency vsc 0.24.1
vscode-java-pack vsc 0.29.0
vscode-java-test vsc 0.43.0
vscode-maven vsc 0.44.0
quokka-vscode Wal 1.0.667
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
9c06g630:31013171
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
nativerepl1:31139838
pythonrstrctxt:31112756
nativeloc1:31185841
cf971741:31144450
iacca1:31171482
notype1cf:31157160
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugeditor-multicursorEditor multiple cursor issuesfreeze-slow-crash-leakVS Code crashing, performance, freeze and memory leak issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions