VeryGoodOpenSource / dart_frog

A fast, minimalistic backend framework for Dart 🎯
https://dartfrog.vgv.dev
MIT License
1.87k stars 150 forks source link

dart_frog VSCode extension slows down VSCode significantly #1487

Open lukasnevosad opened 2 months ago

lukasnevosad commented 2 months ago

Type: Bug

When the extension is enabled, VSCode is significantly slower, even in code that has nothing to do with Dart (TS, Next.js). It especially shows when e.g. clicking a symbol to see its definition definition or it shows "Running 'File Create' participants..." for many seconds when a simple new empty file is created.

Extension version: 0.2.3 VS Code version: Code 1.92.2 (Universal) (fee1edb8d6d72a0ddff41e5f71a671c23ed924b9, 2024-08-14T17:29:30.058Z) OS version: Darwin arm64 23.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 2400)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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)|5, 4, 5| |Memory (System)|16.00GB (1.26GB free)| |Process Argv|--crash-reporter-id 311a7b37-1935-43ef-9642-1aa3900866b8| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vscod805:30301674 binariesv615:30325510 vsaa593:30376534 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 2i9eh265:30646982 962ge761:30959799 pythongtdpath:30769146 welcomedialog:30910333 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 dsvsc021:30996838 9c06g630:31013171 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupytercf:31046870 impr_priority:31102340 nativerepl1:31104043 refactort:31108082 pythonrstrctxt:31112756 flightc:31119335 wkspc-onlycs-t:31111718 wkspc-ranged-t:31118572 ```
alestiago commented 2 months ago

I think I've experienced similar behaviours but I haven't invested the time into benchmarking it. I have a gut feeling that there is a resource that is leaking, might be regarding the daemon or probably during initialization.

@lukasnevosad have you benchmarked or inspected the extension to see what function is using resources that might slow down VSCode?

lukasnevosad commented 2 months ago

I am afraid I have no idea how to debug this. This report came from "Extensions Bisect" feature of VSCode, which pinpointed this extension. I could clearly see immediate results turning the extension on/off. It then even created this GitHub issue on by behalf.

The slow down occurred multiple times before and has not occurred again since I turned this extension off.

The project I've been working on with dart_frog (which is otherwise awesome, btw.) is on hold at the moment, but I will certainly need to switch the extension on again when I return to it, so I will try to do some more debugging then.

orestesgaolin commented 1 month ago

I'm experiencing the same issues, especially around pasting text, pressing Enter and saving files. It applies to not only .dart files but also .md or bash.

In the VS Code stats you can see that Dart Frog extensions can take up to 1000 ms to load whereas other extensions activate within 100 ms.

example

screenshot_20241013_135747

I think one of the issues is also the fact that the extension gets activated with any project containing pubspec.yaml, which in my case was not the intended behavior (e.g. when working with Flutter or pure Dart projects).

tomarra commented 4 weeks ago

I think one of the issues is also the fact that the extension gets activated with any project containing pubspec.yaml, which in my case was not the intended behavior (e.g. when working with Flutter or pure Dart projects).

Hey @orestesgaolin thanks for the feedback here. I'll add a P1 to this given that we have some direction now but I don't have much in team cycles to dedicate to this in the short term. If you are able to help debug or implement a solution and get a PR up it would be greatly appreciated!

orestesgaolin commented 4 weeks ago

All good! I can enable the extension when I need it, so that's not a blocker :) I'll report back if anything obvious pops up