microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.71k stars 29.08k forks source link

Text selection and scrolling is slow #201123

Open kocsis1david opened 10 months ago

kocsis1david commented 10 months ago

Type: Performance Issue

Issue troubleshooting has identified that the issue is with Visual Studio Code.

I can reproduce it by opening a 1000-2000 line file and being on battery saver mode. Turning off battery saver mode helps, but it's still slower than it should be. E.g. selection in this file around line 140 is especially slow. On insiders (1.86.0-insider 279872bd965e4030c81129a9bf1ce1710ff7cd55) it's still slow, but seems a bit faster than 1.85.1.

VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:47:11.635Z) OS version: Linux x64 6.6.7-arch1-1 Modes:

System Info |Item|Value| |---|---| |CPUs|11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz (8 x 1299)| |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
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off| |Load (avg)|1, 1, 1| |Memory (System)|15.34GB (9.22GB free)| |Process Argv|--unity-launch --crash-reporter-id 38cc4293-5223-4300-8642-8985386ac132| |Screen Reader|no| |VM|0%| |DESKTOP_SESSION|gnome| |XDG_CURRENT_DESKTOP|GNOME| |XDG_SESSION_DESKTOP|gnome| |XDG_SESSION_TYPE|wayland|
Process Info ``` CPU % Mem MB PID Process 0 157 14352 code main 0 47 14355 zygote 0 189 14391 gpu-process 0 47 14356 zygote 0 0 14358 zygote 0 456 14433 window [1] (command.rs - engine-test - Visual Studio Code) 0 94 15931 window [2] (Issue Reporter) 0 63 14396 utility-network-service 0 110 14452 shared-process 0 79 15671 fileWatcher [1] 0 126 15955 extensionHost [1] 0 63 15975 electron-nodejs (/opt/visual-studio-code/code --ms-enable-electron-run-as-node /opt/visual-studio-code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=15955) ```
Workspace Info ``` | Window (command.rs - engine-test - Visual Studio Code) | Folder (engine-test): 14093 files | File types: bin(1982) gltf(1696) o(1587) bc(1552) json(813) | timestamp(810) d(760) rmeta(692) rlib(369) rs(346) | Conf files: launch.json(1) settings.json(1) tasks.json(1) | Launch Configs: cppvsdbg lldb; ```

Extensions: none

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30899288
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
282f8724:30602487
f6dab269:30613381
showlangstatbar:30737416
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialogc:30910334
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30902429
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:30885897
pythontbext0:30879054
accentitlementst:30887150
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
aa_t_chat:30882232
dsvsc019cf:30917260
cp7184c:30925681

kocsis1david commented 10 months ago

I searched for the version where the performance regressed and it's the 1.75.1 version. 1.74.3 is fast. Insider version performs about the same as 1.75.1. It's strange that I haven't noticed it earlier that it became slow. 1.75.1 is almost a year ago. But now it's hard to unsee it.

alexdima commented 10 months ago

Could you please follow the steps at https://github.com/microsoft/vscode/wiki/Performance-Issues#profiling-the-renderer-process and capture a CPU profile?

kocsis1david commented 10 months ago

Saving the profile fails with NotAllowedError, this is probably an Electron bug.

Some screenshots of the capture: Screenshot from 2023-12-23 00-04-39 image

The task I zoomed in takes 120ms, and the 2nd screen is zoomed in even more around 12s.

alexdima commented 10 months ago

You're right, Insiders has been updated to Electron 27 and suffers from https://github.com/microsoft/vscode/issues/200668 . Could you please capture a profile with stable?

kocsis1david commented 10 months ago

That was 1.85.1 with Electron 25.9.7. But I'll check tomorrow if I can save it somehow.

kocsis1david commented 10 months ago

Profile-20231225T084134.zip I made a profile with 1.81.1, this is the most recent version where it didn't fail.