graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
557 stars 71 forks source link

High CPU utilization #95

Closed laith43d closed 5 years ago

laith43d commented 5 years ago

Issue Type: Performance Issue

A major performance issue happens all the time, even if I haven't opened a project. It starts just after enabling the extension (GraphQL by Prisma), a process under "extensionHost" called "electron_node server.js" appears which utilizes up to 25% of my Ci7 8750H CPU! My system is an up to date Windows 10 Pro, on the latest Dell XPS 9570 with 32GB RAM.

Extension version: 0.1.6 VS Code version: Code 1.30.1 (dea8705087adb1b5e5ae1d9123278e178656186a, 2018-12-18T18:12:07.165Z) OS version: Windows_NT x64 10.0.17134

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz (12 x 2208)| |GPU Status|2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled| |Memory (System)|31.74GB (16.41GB free)| |Process Argv|.\backend\| |Screen Reader|no| |VM|40%|
Process Info ``` CPU % Mem MB PID Process 0 119 21672 code main 0 251 1488 window (backend - Visual Studio Code [Administrator]) 0 37 9916 searchService 1 163 15020 extensionHost 0 42 21976 "C:\Users\laith\AppData\Local\Programs\Microsoft VS Code\Code.exe" "c:\Users\laith\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\jsonServerMain" --node-ipc --clientProcessId=15020 8 74 21980 electron_node server.js 0 11 18276 watcherService 0 9 2092 console-window-host (Windows internal process) 0 105 6344 shared-process 0 224 15784 gpu-process 0 67 16816 window (Issue Reporter) 0 148 17416 window (Process Explorer) ```
Workspace Info ``` | Window (backend - Visual Studio Code [Administrator]) | Folder (backend): 15 files | File types: js(7) yml(2) json(2) graphql(2) prisma(1) env(1) | Conf files: package.json(1); ```
sapkra commented 5 years ago

I'm having the same problem with Mac OS 10.14.2 on a Macbook Pro 2018 15".

I disabled all my plugins and enabled all after each other to detect that this plugin is the one with the high CPU usage.

divyenduz commented 5 years ago

@laith43d , @sapkra Thanks for the details and investigation. Are you using the extension on projects with a lot of files? If yes, what is the project size (in terms of number of GraphQL/TS files and size of GraphQL schema) that we are looking at?

sapkra commented 5 years ago

Hey, I executed this command in my project root to count the amount of files with those endings (incl. node_modules).

find . -not -type d | egrep -v '\.ts$' | wc -l
102319

and

find . -not -type d | egrep -v '\.graphql$' | wc -l
106659

But I have to say that my project is at the beginning so it seems like the node_modules have a lot of files.

So I also checked this. I'm using a mono repo so I'll show you the amount of my frontend & backend.

frontend node_modules

ts: 78761 graphql: 80554

backend node_modules

ts: 20609 graphql: 23100

Schema size

And you also wanted the know the size of my schema: it just has 124 lines

divyenduz commented 5 years ago

@sapkra Thanks for the information, really helpful. I am closing this one in favor of https://github.com/prisma/vscode-graphql/issues/89 as it has more information. Let us use that to track a resolution for this 🙏