Vscode: Very slow start with snap package

Created on 23 Oct 2018  路  20Comments  路  Source: microsoft/vscode

Issue Type: Performance Issue

Since upgrade to Ubuntu 18.10 - perhaps related - vscode takes over a minute to start up , maxing out CPU and sending load average soaring. Once system recovers vscode seems normal. However attempting to open a file from command line with command code <filename> returns immediately but takes similar amount of time - up to a minute - before file appears in the editor, though not with same high CPU symptom.

An strace -p to the code process while it's starting up shows lots of lseek/reads (I'm not sure how to interpret that info to be more helpful) - I presume it's reading through some massive amount of files/data or something?

VS Code version: Code 1.28.2 (7f3ce96ff4729c91352ae6def877e59c561f4850, 2018-10-17T00:20:56.183Z)
OS version: Linux x64 4.15.0-36-generic


System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5 CPU M 520 @ 2.40GHz (4 x 1197)|
|GPU Status|2d_canvas: unavailable_software
checker_imaging: disabled_off
flash_3d: unavailable_software
flash_stage3d: unavailable_software
flash_stage3d_baseline: unavailable_software
gpu_compositing: unavailable_software
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: unavailable_software
video_decode: unavailable_software
video_encode: unavailable_software
webgl: enabled_readback
webgl2: unavailable_off|
|Load (avg)|2, 2, 2|
|Memory (System)|7.72GB (0.39GB free)|
|Process Argv|--disable-extensions|
|Screen Reader|no|
|VM|0%|


Process Info

CPU %   Mem MB     PID  Process
    2      166   31313  code main
    0       40   31315     zygote
    0      119   31499       shared-process
   27      308   32303       window (Welcome - mp (Workspace) - Visual Studio Code)
    2      158   32326         extensionHost
    0        8   32331         /bin/bash
    0       63   32333         watcherService
    2      103   32509       window (Issue Reporter)
    0        0   32626     /bin/sh -c /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=
    0        0   32627       /bin/ps -ax -o pid=,ppid=,pcpu=,pmem=,command=



Workspace Info

|  Window (Welcome - mp (Workspace) - Visual Studio Code)
|    Folder (gtfe): more than 34258 files
|      File types: png(6182) jpg(4463) py(4080) js(3310) pyc(3056) sql(1670)
|                  pdf(1546) htm(1340) html(1045) ini(481)
|      Conf files: package.json(43) grunt.js(24) gulp.js(7) makefile(6)
|                  launch.json(1) settings.json(1) tslint.json(1)
|      Launch Configs: python(5)
|    Folder (mp): 5300 files
|      File types: py(1689) pyc(1681) h(184) txt(111) so(74) whl(23) exe(20)
|                  rst(18) json(17) conf(12)
|      Conf files: settings.json(1);


Extensions disabled

bug linux perf perf-startup snap upstream

Most helpful comment

I've confirmed with the Snap team that this is an issue on their part. It is related to loading fonts.

  • On 18.04, initial startup is very slow, since loading all the fonts is slow. But fonts actually get cached to ~/.cache/fontconfig. So, successive launches use that cache.
  • On 18.10, font information seems to be RAM only. So, launching is always slow.

The team will address this soon, as far as I was informed.

All 20 comments

A further observation: opening a file from the quick file picker (ctrl + p) opens quickly, as does opening file from traditional file open dialog (ctrl + o).

I noticed vscode was installed as a snap not a traditional .deb package, so I removed the snap and installed from downloaded .deb:

sudo snap remove vscode
sudo dpkg -i code_1.28.2-1539735992_amd64.deb

and now vscode is behaving normally!

I noticed vscode was installed as a snap not a traditional .deb package,

@Tyriar you talked about this once, right?

screenshot 2018-10-23 at 15 57 05

So, there is a v e r y long time in which nothing JavaScript'ish happens. This is mostly likely a delayed app read event. @nickyspag Do you still have the snap install? Can copy/paste what's being printed when calling "F1 > Startup Performance"?

@jrieken I uninstalled the snap, so that I could get some work done :-) but can easily reinstall it... BUT there is no visible window during the long startup for me to press F1 in ... is there another way (like with command line params) that I can get more useful info for you?

There is a warning when installing the vscode snap about it being a "classic" snap and one has to add the --classic option to get it to install - I know precious little about snaps but maybe something to do with it?

BUT there is no visible window during the long startup for me to press F1 in ... is there another way

Does it not finish? Eventually, when a window is being shown F1 should be functional...

I know precious little about snaps but maybe something to do with it?

I know less but yeah sounds like this is a snap issue.

Sorry I thought you meant wHILE it was opening.

Here's what's in the Startup Performance console after starting the snap version:

image
-1540305625449.log

Thanks - it apparently takes 77018ms to receive the app ready event from electron (main:started till main:appReady). During that time we are hand-cuffed, electron started us be we can do much yet cos we wait for outside things...

This is maybe the same as or very much related to #22087

I am having the same experience after upgrading to cosmic (ubuntu 18.10), using the snap version. Going to install the deb binary and see how that works out!

-v output

1.28.2
7f3ce96ff4729c91352ae6def877e59c561f4850
x64

Startup Performance:
image

image

Here's my times after the latest 64-bit deb install. MUCH faster.

-v output

1.28.2
7f3ce96ff4729c91352ae6def877e59c561f4850
x64

image

@Tyriar slow, snap, rings a bell?

I have the same problem after I upgraded to Ubuntu 18.10 with snap version of vscode.

I've confirmed with the Snap team that this is an issue on their part. It is related to loading fonts.

  • On 18.04, initial startup is very slow, since loading all the fonts is slow. But fonts actually get cached to ~/.cache/fontconfig. So, successive launches use that cache.
  • On 18.10, font information seems to be RAM only. So, launching is always slow.

The team will address this soon, as far as I was informed.

I've gotten a very promising update on a snapd fix:

  • Cold start launch time was reduced from ~1min 37secs to ~23secs
  • Hot start lunch time was reduced from 1min 32secs to ~5secs

This was done on the same machine running 18.10 with those latest changes. I was told the changes are not out yet, but coming soon.

Much better but still slow. Having 23secs for the first startup isn't something I would endure, esp. not as an Insiders user. Do they have plans to make this fast?

I believe this has been recently fixed. Start time has turned almost instant.

We fixed this in snapd 2.36.2 which was released last week :smiley:

@Tyriar @joaomoreno This can be closed.

Was this page helpful?
0 / 5 - 0 ratings