zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.59k stars 2.64k forks source link

High CPU usage on startup in Linux #13552

Open goldenratio opened 2 months ago

goldenratio commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Environment

09:48:45 fermi@fedora bin → fastfetch 
             .',;::::;,'.                 fermi@fedora
         .';:cccccccccccc:;,.             ------------
      .;cccccccccccccccccccccc;.          OS: Fedora Linux 40 (Workstation Edition) x86_64
    .:cccccccccccccccccccccccccc:.        Host: 20217 (Lenovo IdeaPad Y510P)
  .;ccccccccccccc;.:dddl:.;ccccccc;.      Kernel: Linux 6.8.9-300.fc40.x86_64
 .:ccccccccccccc;OWMKOOXMWd;ccccccc:.     Uptime: 1 day, 3 hours, 4 mins
.:ccccccccccccc;KMMc;cc;xMMc;ccccccc:.    Packages: 2042 (rpm), 19 (flatpak)
,cccccccccccccc;MMM.;cc;;WW:;cccccccc,    Shell: bash 5.2.26
:cccccccccccccc;MMM.;cccccccccccccccc:    Display (DELL P2723DE): 2560x1440 @ 60Hz
:ccccccc;oxOOOo;MMM000k.;cccccccccccc:    DE: GNOME 46.1
cccccc;0MMKxdd:;MMMkddc.;cccccccccccc;    WM: Mutter (X11)
ccccc;XMO';cccc;MMM.;cccccccccccccccc'    WM Theme: Adwaita
ccccc;MMo;ccccc;MMW.;ccccccccccccccc;     Theme: Adwaita [GTK2/3/4]
ccccc;0MNc.ccc.xMMd;ccccccccccccccc;      Icons: Adwaita [GTK2/3/4]
cccccc;dNMWXXXWM0:;cccccccccccccc:,       Font: Cantarell (11pt) [GTK2/3/4]
cccccccc;.:odl:.;cccccccccccccc:,.        Cursor: Adwaita (24px)
ccccccccccccccccccccccccccccc:'.          Terminal: GNOME Terminal 3.50.1
:ccccccccccccccccccccccc:;,..             Terminal Font: JetBrains Mono (11pt)
 ':cccccccccccccccc::;,.                  CPU: Intel(R) Core(TM) i7-4700MQ (8) @ 3.40 GHz
                                          GPU 1: NVIDIA GeForce GT 755M [Discrete]
                                          GPU 2: NVIDIA GeForce GT 755M [Discrete]
                                          Memory: 5.37 GiB / 15.56 GiB (35%)
                                          Swap: 0 B / 8.00 GiB (0%)
                                          Disk (/): 29.64 GiB / 952.29 GiB (3%) - btrfs
                                          Local IP (enp8s0): 192.168.1.114/24 *
                                          Battery: 100% [AC Connected]
                                          Locale: en_US.UTF-8

If applicable, add mockups / screenshots to help explain present your vision of the feature

Screenshot from 2024-06-26 21-49-32 Screenshot from 2024-06-26 21-49-23

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

Zed.log


natemcintosh commented 1 month ago

I'm seeing something very similar. I checked out the advice on the linux docs page, ran vkcube, did not see anything about llvmpipe, but did see

MESA-INTEL: warning: cannot initialize blitter engine
Selected GPU 0: Intel(R) Arc(tm) A750 Graphics (DG2), type: 2

I should note that when I run zed I do not see any GPU usage, but do see ~60-70% CPU usage (total of all processors, not on single processor).

I installed via

curl https://zed.dev/install.sh | sh

on 2024-07-10.

Also, where can I find the logs on linux? I ran

cd /
fd zed.log
fd Zed.log

But got nothing from either search.

Don't know if it's helpful, but in case it is:

            /////////////                nathanmcintosh@pop-os 
         /////////////////////            --------------------- 
      ///////*767////////////////         OS: Pop!_OS 22.04 LTS x86_64 
    //////7676767676*//////////////       Host: ABS Gaming PC 
   /////76767//7676767//////////////      Kernel: 6.9.3-76060903-generic 
  /////767676///*76767///////////////     Uptime: 8 days, 22 hours, 47 mins 
 ///////767676///76767.///7676*///////    Packages: 2358 (dpkg), 38 (flatpak) 
/////////767676//76767///767676////////   Shell: bash 5.1.16 
//////////76767676767////76767/////////   Resolution: 1920x1080, 1920x1080 
///////////76767676//////7676//////////   DE: GNOME 42.9 
////////////,7676,///////767///////////   WM: Mutter 
/////////////*7676///////76////////////   WM Theme: Pop 
///////////////7676////////////////////   Theme: Pop [GTK2/3] 
 ///////////////7676///767////////////    Icons: Pop [GTK2/3] 
  //////////////////////'////////////     Terminal: gnome-terminal 
   //////.7676767676767676767,//////      CPU: Intel i7-14700F (28) @ 5.300GHz 
    /////767676767676767676767/////       GPU: Intel Device 56a1 
      ///////////////////////////         Memory: 7516MiB / 31912MiB 
         /////////////////////
             /////////////                                        
Cornichon0097 commented 1 month ago

Describe the bug / provide steps to reproduce it

I have a similar problem when using Zed. CPU usage reaches 80 to 90% every time I open a file from the project’s tree files and the editor is pretty slow I just installed Zed, so my settings are nearly default:

{
  "theme": {
    "mode": "dark",
    "light": "Ayu Light",
    "dark": "One Dark"
  },

  "base_keymap": "Atom",
  "ui_font_size": 16,
  "buffer_font_size": 14
}

Environment

$ fastfetch
       _,met$$$$$gg.           cornichon@hp-compaq8200
    ,g$$$$$$$$$$$$$$$P.        -----------------------
  ,g$$P"         """Y$$.".     OS: Debian GNU/Linux bookworm 12.6 x86_64
 ,$$P'               `$$$.     Host: HP Compaq 8200 Elite SFF PC
',$$P       ,ggs.     `$$b:    Kernel: Linux 6.1.0-22-amd64
`d$$'     ,$P"'   .    $$$     Uptime: 39 mins
 $$P      d$'     ,    $$$P    Packages: 1807 (dpkg)
 $$:      $.   -    ,d$$'      Shell: bash 5.2.15
 $$;      Y$b._   _,d$P'       Display (ASUS VP228): 1920x1080 @ 60Hz
 Y$$.    `.`"Y$$$$P"'          DE: Xfce4 4.18
 `$$b      "-.__               WM: Xfwm4 (X11)
  `Y$$                         WM Theme: Default
   `Y$$.                       Theme: HighContrast [GTK2/3/4]
     `$$b.                     Icons: Adwaita [GTK2/3/4]
       `Y$$b.                  Font: Sans (10pt) [GTK2/3/4]
          `"Y$b._              Cursor: Adwaita
             `"""              Terminal: GNOME Terminal 3.46.8
                               Terminal Font: Monospace (11pt)
                               CPU: Intel(R) Core(TM) i7-2600 (8) @ 3.80 GHz
                               GPU: Intel 2nd Generation Core Processor Family ]
                               Memory: 3.64 GiB / 15.51 GiB (23%)
                               Swap: 0 B / 976.00 MiB (0%)
                               Disk (/): 19.94 GiB / 217.57 GiB (9%) - ext4
                               Local IP (eno1): 192.168.42.216/24
                               Locale: en_GB.UTF-8

If applicable, add mockups / screenshots to help explain present your vision of the feature

A screenshot of CPU usage when switching to Zed window and then opening a 150 lines Makefile (I’ve only scrolled to the end of the file): Screenshot_2024-07-17_00-07-36

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue

$ tail -n 50 .local/share/zed/logs/Zed.log
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-16T23:34:11+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:05:59+02:00 [INFO] starting language servers for Make: 
2024-07-17T00:05:59+02:00 [INFO] starting language servers for JSONC: json-language-server
2024-07-17T00:05:59+02:00 [INFO] starting language servers for Make: 
2024-07-17T00:06:02+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:03+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:04+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:05+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }
2024-07-17T00:06:06+02:00 [WARN] Unknown button press: ButtonPressEvent { .. }

Hope it can be helpful :)

ronanM commented 1 month ago

I follow the instructions of https://zed.dev/docs/linux#zed-is-very-slow.

My system:

Operating System: Kubuntu 24.04
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.13
Kernel Version: 6.8.0-39-generic (64-bit)
Graphics Platform: X11
Processors: 8 × AMD FX(tm)-8350 Eight-Core Processor
Memory: 31,2 GiB of RAM
Graphics Processor: NVIDIA GeForce GT 720/PCIe/SSE2
Manufacturer: MSI
Product Name: MS-7640
System Version: 2.2
$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 24.04 LTS"

$ uname -a
Linux ronan-GA-MA78GM-S2H 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul  5 21:49:14 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

$ echo $XDG_SESSION_TYPE 
x11

$ vkcube
Selected GPU 0: NVIDIA GeForce GT 720, type: DiscreteGpu
# ✅ Ok, cube rotate smoothly.

$ zed --version
Zed 0.146.3 – /home/ronan/.local/zed.app/libexec/zed-editor

$ zed
# 💥 Boom, very slow.

$ grep "Using GPU" ~/.local/share/zed/logs/Zed.log
2024-08-05T09:24:40.389296312+02:00 [INFO] Using GPU: GPUSpecs { is_software_emulated: true, device_name: "llvmpipe (LLVM 17.0.6, 256 bits)", driver_name: "llvmpipe", driver_info: "Mesa 24.0.9-0ubuntu0.1 (LLVM 17.0.6)" }

$ MESA_VK_DEVICE_SELECT=list zed --foreground
selectable devices:
  GPU 0: 10de:1288 "NVIDIA GeForce GT 720" discrete GPU 0000:01:00.0
  GPU 1: 10005:0 "llvmpipe (LLVM 17.0.6, 256 bits)" CPU 0000:00:00.0

$ MESA_VK_DEVICE_SELECT=10de:1288 zed
# 💥 Boom, very slow.

$ grep "Using GPU" ~/.local/share/zed/logs/Zed.log
2024-08-05T09:26:11.911357986+02:00 [INFO] Using GPU: GPUSpecs { is_software_emulated: true, device_name: "llvmpipe (LLVM 17.0.6, 256 bits)", driver_name: "llvmpipe", driver_info: "Mesa 24.0.9-0ubuntu0.1 (LLVM 17.0.6)" }