Skip to content

Poor search performance in large repositories #38799

@bjackman

Description

@bjackman

Summary

Poor search performance in large repositories

Description

Using the linux kernel repo as an example. This is not particularly extreme but it's big enough that a dumb grep is unusably slow:

❯❯  time git grep vmx_l1d_should_flush
[...]

________________________________________________________
Executed in  826.73 millis    fish           external
   usr time    0.76 secs    985.00 micros    0.76 secs
   sys time    3.83 secs      0.00 micros    3.83 secs

❯❯  time grep -R vmx_l1d_should_flush .
...

________________________________________________________
Executed in   49.77 secs    fish           external
   usr time    8.49 secs  986.00 micros    8.49 secs
   sys time    9.32 secs   88.00 micros    9.32 secs

Timing Zed's project search for the string, (using my stopwatch on my phone), I find when I am connected to the server above via SSH (i.e. using Zed's remoting feature), the same search takes about 4s.

Doing the same search again locally on my laptop takes 559.40 millis with Git and about 3s with Zed.

I noticed when I first open the project in Zed, there's a Git process that hogs the CPU for a litle while. Combined with the fact that it's still much faster than a dumb grep, it looks like there's some optimisation working here, but it's just missing some trick or other.

With my stopwatch on my phone I measured about 4s to grep this repo in Zed. This is when remoting from a laptop with an Intel(R) Core(TM) Ultra 7 165U (Meteor Lake, 2023) into a high-spec GCP VM (some sort of Cascade Lake I think).

Steps to reproduce:

  1. Have kinda decent laptop
  2. Checkout https://github.com/torvalds/linux)
  3. Use the project search

Expected Behavior: B L A Z I N G F A S T R U S T C O D E
Actual Behavior: Have to wait literally MILLIONS of microseconds for my search results
:

click to expand

settings:

{
  "ssh_connections": [ <REDACTED> ],
  "base_keymap": "VSCode",
  "vim_mode": true,
  "file_types": {
    "makefile": ["*.makefile"]
  },
  "show_whitespaces": "boundary",
  "soft_wrap": "editor_width",
  "use_smartcase_search": true,
  "cursor_blink": false,
  "auto_update": false,
  "telemetry": {
    "metrics": false
  },
  "wrap_guides": [80],
  "languages": {
    "Nix": {
      "show_whitespaces": "none",
      "tab_size": 2
    }
  }
}

Log:

2025-09-24T18:17:53+02:00 INFO  [zed] ========== starting zed version 0.204.5, sha 289a4a6 ==========
2025-09-24T18:17:53+02:00 INFO  [zed] Using git binary path: None
2025-09-24T18:17:53+02:00 INFO  [crashes] spawning crash handler process
2025-09-24T18:17:54+02:00 INFO  [extension_host] extensions updated. loading 6, reloading 0, unloading 0
2025-09-24T18:17:54+02:00 INFO  [gpui::platform::linux::platform] activate is not implemented on Linux, ignoring the call
2025-09-24T18:17:54+02:00 INFO  [crashes] connected to crash handler process after 100ms
2025-09-24T18:17:54+02:00 INFO  [crashes] crash handler registered
2025-09-24T18:17:54+02:00 INFO  [util] set environment variables from shell:/bin/bash, path:/usr/local/google/home/jackmanb/.nix-profile/bin:/usr/local/google/home/jackmanb/.local/bin:/home/jackmanb/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/lib/google-golang/bin:/usr/local/buildtools/java/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
2025-09-24T18:17:54+02:00 INFO  [gpui::platform::blade::blade_renderer] Initializing Blade pipelines for surface SurfaceInfo { format: Bgra8UnormSrgb, alpha: PreMultiplied }
2025-09-24T18:17:54+02:00 INFO  [zed::zed] Using GPU: GpuSpecs { is_software_emulated: false, device_name: "Intel(R) Graphics (MTL)", driver_name: "Intel open-source Mesa driver", driver_info: "Mesa 25.0.7-2" }
2025-09-24T18:17:54+02:00 INFO  [project::environment] using project environment variables shell launched in "/home/jackmanb/src/linux". PATH="/usr/local/google/home/jackmanb/.nix-profile/bin:/usr/local/google/home/jackmanb/.local/bin:/home/jackmanb/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/lib/google-golang/bin:/usr/local/buildtools/java/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
2025-09-24T18:18:11+02:00 INFO  [language] downloading language server "clangd"
2025-09-24T18:18:11+02:00 INFO  [lsp] starting language server process. binary path: "/home/jackmanb/.var/app/dev.zed.Zed/data/zed/languages/clangd/clangd_21.1.0/bin/clangd", working directory: "/home/jackmanb/src/linux", args: []

Zed Version and System Specs

Zed: v0.204.5 (Zed)
OS: Linux Wayland debian unknown
Memory: 62.3 GiB
Architecture: x86_64
GPU: Intel(R) Graphics (MTL) || Intel open-source Mesa driver || Mesa 25.0.7-2

Metadata

Metadata

Assignees

No one assigned

    Labels

    large projectsFor anything relating to large volumes of files or multiple subprojects in one main project.performanceFeedback for performance issues, speed, memory usage, etcsearchbuffer search, project search, etc

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions