MicrosoftDocs / intellicode

Visual Studio IntelliCode - AI-enhanced development tools. 👋Want to submit an issue to MicrosoftDocs/intellicode? If you have a bug or an idea, read the contributing guidelines before opening an issue. For FAQ's see
https://aka.ms/vsicfaq
Creative Commons Attribution 4.0 International
752 stars 69 forks source link

[`VisualStudioExptTeam.intellicode-api-usage-examples`] Bad file save performance #369

Open Faithfinder opened 2 years ago

Faithfinder commented 2 years ago

Issue Type: Performance Issue

So, I'm doing some work requiring mass search and replace, and I've noticed bad performance - whenever I replaced an occurence, file saving hung up for a time. Some research led me to understanding that it's extension host, and Extension Bisect (https://code.visualstudio.com/blogs/2021/02/16/extension-bisect) led me to IntelliCode API Usage Examples . It also offered to file an issue, so here I am.

Extension version: 0.1.1 VS Code version: Code 1.67.2 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5, 2022-05-17T18:15:52.058Z) OS version: Windows_NT x64 10.0.22621 Restricted Mode: No Connection to 'wsl+ubuntu' could not be established

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz (8 x 3600)| |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
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|31.91GB (11.02GB free)| |Process Argv|--crash-reporter-id b1db9ef2-a6cc-4a91-b491-fed307cca03f| |Screen Reader|no| |VM|0%| Connection to 'wsl+ubuntu' could not be established
Process Info ``` CPU % Mem MB PID Process 0 139 32120 code main 0 345 11796 window (HobbyRepository.ts - main (Workspace) [WSL: Ubuntu] - Visual Studio Code) 0 59 15344 crashpad-handler 0 88 16424 issue-reporter 0 67 23980 utility-network-service 1 181 29772 extensionHost 0 85 32656 "C:\Users\faith\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node c:\Users\faith\.vscode\extensions\formulahendry.auto-rename-tag-0.1.10\packages\server\dist\serverMain.js --node-ipc --clientProcessId=29772 0 85 36156 "C:\Users\faith\AppData\Local\Programs\Microsoft VS Code\Code.exe" --ms-enable-electron-run-as-node c:\Users\faith\.vscode\extensions\ms-vscode-remote.remote-wsl-0.66.3\dist\wslDaemon.js 1 123 38272 shared-process 0 62 38324 ptyHost 0 88 39112 fileWatcher 0 172 40004 gpu-process Connection to 'wsl+ubuntu' could not be established ```
Workspace Info ``` Connection to 'wsl+ubuntu' could not be established; ```
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythonvspyl392:30443607 pythontb:30283811 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805:30301674 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593:30376534 vsc1dst:30438360 pythonvs932:30410667 wslgetstarted:30449410 vscscmwlcmt:30465135 cppdebug:30492333 vsclangdf:30486550 ```
ayim commented 2 years ago

@osobeso mind taking a look when you've got some time?

osobeso commented 2 years ago

@ayim I'm looping in the codesearch team, as this seems to be triggered by their API. We will be taking a look.

osobeso commented 2 years ago

@Faithfinder Thanks for reporting this issue. Would you mind sharing the number of lines the current file or files you're working with? If it's more than one file, it can be an average of line numbers. We would like to do some stress testing on our side. In the meantime, I'll advise you to disable the extension so that it doesn't impact on your user experience while we find a solution for it.

Thanks again!

Faithfinder commented 2 years ago

It's ~500 files, ranging from ~15 lines minimum to 2-3 thousands maximum, can't really tell an average but 300 line files seem to be prevalent. File size didn't seem to critically affect the duration of each hang up. The extension host hung up for at least 10 seconds on each replacement with cumulative effect reaching minute or two after ~10 files.

The project is a moderately sized monorepo where I've been doing replacements like organization|facility (regex search on) with community. I've been doing replacements on a file-by-file, and sometimes line-by line basis, not in bulk. Another "side-effect" was that VSCode detected conflicting writes to some of the files (e.g. when extension host finished it's thing I got this notification. Pic off the internet. image)

Faithfinder commented 2 years ago

https://github.com/microsoft/rushstack This public repo is very similar in setup to ours and I can sort of reproduce the behaviour with it. Just do the same search setup and then click replace all on each file in sequence. image image

The difference is that for some reason the hangups dissolve quite a bit faster than in our repo (might be related to what I'm replacing or some other traits of the source code itself?), so I've had to click replace a lot more furiously than I did in "real life", but otherwise the effect is the same including writing conflicts.

Faithfinder commented 2 years ago

Oh! Another detail - right now I'm running WSL, but I've also encountered this problem on a purely Ubuntu machine, so not WSL related.

github-actions[bot] commented 2 years ago

Automatically marked uncategorized issue as product feedback