language-tools
language-tools copied to clipboard
high cpu usage
Issue Type: Bug
I turned off all plugins except prisma, I use nx monorepo and tried to create minimal reproduction, but failed to reproduce.
add more details later.
Extension version: 3.12.0 VS Code version: Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:47:29.396Z) OS version: Darwin arm64 21.3.0 Restricted Mode: No
System Info
| Item | Value |
|---|---|
| CPUs | Apple M1 (8 x 24) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled metal: disabled_off 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 webgl: enabled webgl2: enabled |
| Load (avg) | 7, 11, 11 |
| Memory (System) | 16.00GB (0.07GB free) |
| Process Argv | --crash-reporter-id a7b608fd-1ae2-4400-ba59-15416892bf9e |
| Screen Reader | yes |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
After I disabe Prisma fileWatcher, CPU usage is back to normal quickly.
#1118

Maybe some directories should be disabled by default, here are the settings I've had performance issues with vscode in the past.
"search.followSymlinks": false,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/tmp": true,
"**/node_modules": true,
"**/bower_components": true,
"**/dist": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true,
"**/tmp/**": true,
"**/bower_components/**": true,
"**/dist/**": true
},
Having this issue as well. Immediately after installing this extension my CPU usage spiked to maximum, showing electron as the offender. I let it run at max for 3-5 min. After disabling the extension, CPU usage quickly returned to normal.
Extension version v3.12.0
I have the same issue. It occurs both on Insider and stable versions of the extension. CPU instantly goes crazy when the extension is installed.
Seems to be ok when filewatcher is disabled.
If anyone can give us a repository that can reproduce the issue that would be very helpful. We know this is happening, but we just do not have a reliable way to reproduce and thus debug it.
I can't sorry. It's not my personal project.
My equipment is the intel version of Macbook Pro.
If anyone can give us a repository that can reproduce the issue that would be very helpful. We know this is happening, but we just do not have a reliable way to reproduce and thus debug it.
Hi! @ivoljubicic @otus-jfortman @think2011 @dannylee1020
I created a PR to fix the file watcher issue, I'm happy to report that on my computer (macOS m1) it's now fixed. (CPU goes from ~100% previously to 0%)
Could you confirm it's also fixed for you as well?
Follow these instructions
First, confirm that the CPU usage is high using the Prisma extension from the VS Code marketplace
- Open your project using Prisma
- If you disabled the Prisma File Watcher functionality, enable it again from the command palette:

- Open the
schema.prismafile from your project - Use "Open Process Explorer" from VS Code' menu or open the OS Activity monitor

- Note / screenshot the CPU usage for the extension host above the Prisma extension process for the explorer or for the Activity Monitor, the
Code Helper (Renderer)value and share it at the end
Second, confirm that with the new extension the CPU usage is low using a special build from my PR
Note: only the file watcher logic was changed.
- Uninstall any Prisma extension installed (uninstall is preferred as only disabling might interfere in some ways)
- Download https://github.com/prisma/language-tools/blob/artifacts/pull-request-artifacts/pr1243-prisma.vsix?raw=true
- Click "Install from VSIX" from this button (screenshot) or command palette and select the
pr1243-prisma.vsixfile
- Restart the VS Code application
- Open the
schema.prismafile from your project - Use "Open Process Explorer" from VS Code' menu or open the OS Activity monitor

- Note / screenshot the CPU usage for the extension host above the Prisma extension process for the explorer or for the Activity Monitor, the
Code Helper (Renderer)value and share it at the end
Third, if you have a TypeScript project, confirm that the file watcher works and that the types are refreshed
- Open a TypeScript file from your project where you have Prisma Client queries like
await prisma.user.findMany() - Open the
schema.prismafile from your project - Both should have no errors
- Edit the
schema.prismafile and delete all the models (only keep thedatasource&generatorblocks) - Run
npx prisma generate - In your TypeScript file, you should now instantly see a Type Error that should look like the following

- Undo the changes in your
schema.prisma - Run
npx prisma generate - The Type Error(s) in the TypeScript file should be gone now
Please share something like the following: I tested on ... (macOS m1, Windows, Linux....)
- Current extension: screenshot showing ~91% CPU (Note: CPU is only reported on the aggregated top line for some reason)

- Using
pr1243-prisma.vsix, screenshot after showing ~0% CPU usage 🎊
- The typings were updated successfully after
npx prisma generate, a Type Error was visible ✅
Thank you in advance 💚 Note: I'm waiting for some feedback before we switch to this new low CPU file watcher in a stable release on VS Code marketplace.
The fix is now in the latest 4.4.0 version on the marketplace https://marketplace.visualstudio.com/items?itemName=Prisma.prisma 🎊
For those who disabled the File Watcher functionality, you can enable it again.