KatsuteDev / Background

The most advanced background image extension for VSCode
https://marketplace.visualstudio.com/items?itemName=katsute.code-background
GNU General Public License v2.0
86 stars 5 forks source link

Extreme lag when setting folder for editor backgrounds using VS Code Insiders #77

Closed Lamarcke closed 1 year ago

Lamarcke commented 1 year ago

Operating System

Windows 10

VSCode Version

1.75.0-insider

Extension Version

2.3.1

Issue

When using the background config menu, and setting a folder as the glob for background in the "Editor", VS Code takes a long time to load, and using a low wallpaper change time cause huge lags. This doesn't happen while setting the background for "Window" or when you use a single file as background.

PS: While using a small Time parameter while setting a folder as glob in the "Window" setting causes a very small CPU spike, it's completely doable, and the loading works as expected.

How to replicate

Open background menu > choose Editor > select folder as glob > Reload editor. Your editor should take longer to start.

Additionally, if you set the "Time" parameter to something like 5-10 seconds, reverting this change becomes almost impossible, as the editor is constantly lagging when changing backgrounds.

I believe this has something to do with the actual wallpaper load, because it only happens when the file is being loaded (and with a low Time, it's loaded constantly), after that the performance is normalized.

Katsute commented 1 year ago

Long load times could be caused by excessive files or large images.

Please check the folder properties and let me know the:

Also the largest image file size (kb/mb) being used.

Lamarcke commented 1 year ago

I understand. I just find it strange that this only happens when you set the folder for the "editor" setting, but for the "window" setting it works just fine. The biggest problem is not the actual load time, but the fact that the editor hangs when using a small Time parameter.

Output from ls (length is in bytes):


    Directory: D:\Random\anime\vs-code

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        19/12/2022     23:18        4967473 2b-maskless-fixed.png
-a----        19/12/2022     17:16         452824 2b.png
-a----        20/12/2022     00:47         503816 illya-girl-1.png
-a----        20/12/2022     01:06         560934 illya-girl-2.png
-a----        20/12/2022     01:13         275758 illya-girl-3.png
-a----        20/12/2022     01:16         277325 illya-girl-4.png
-a----        20/12/2022     01:21         689823 illya-girl-5.png
-a----        20/12/2022     01:28         519940 illya-girl-6.png
-a----        20/12/2022     01:34         270087 illya-girl-7.png
-a----        20/12/2022     01:37         677789 illya-girl-8.png
-a----        20/12/2022     01:02         155129 illya-transparent-girl-2.png
-a----        20/12/2022     00:35         314333 illya-transparent-girl.png
-a----        19/12/2022     18:08        1662790 marin.png
-a----        20/12/2022     00:15         580555 ougi-oshino-2-resized.png
-a----        18/12/2022     04:48         603112 zero_two_obsidian.png

The biggest image is 2b-maskless-fixed.png (4,73MB).
I tried removing it from the folder and the load time for the different images is the same (though the startup time is way smaller), and it makes the editor hang for a good 2-3 seconds when changing backgrounds, with a small or big Time value.

I'm using a single folder with 14 items (this big one excluded).

As i said, this only happen when using it as the Editor background, not for the Window, which honestly i can live with.

I'm curious though, is setting a background for the editor more taxing than for the whole window?

By the way, this extensions is really good. Thank you for your hard work. It also works with the new Settings Profiles feature of VS Code insiders, which is really nice (i install it on a global profile, and it's settings persists when using a profile that doesn't have the extension installed.)

I mention it in a theme I'm building: https://github.com/Lamarcke/kanagawa.black.vscode#extreme-ricing

Katsute commented 1 year ago

Poor editor performance seems to be caused by #69; this may be fixed by #78. There is some additional logic for editor backgrounds so you don't see duplicates when splitting horizontally and vertically.

Long load times when loading images usually only occurs once per image, since vscode caches these in the background; this might also be fixed by #78.