Skip to content

High CPU use when inline completion is suggested #54069

@firefueled

Description

@firefueled

Reproduction steps

For context, this is happening on a Django project.

  1. Open a large (~200 lines) html file
  2. Do some modifications to it that are sure to trigger an inline completion
  3. The suggestion prompt appears, as I hear my CPU fans spin faster and louder
  4. Checking htop, I see that a single CPU core is 100%, while the other 15 are normal between 1% and 20%

Closing the editor is the only thing that takes down the CPU spike, but if I open it again after just a few seconds, the CPU spike starts again.

However, this doesn't happen every time. If I close Zed and open it again enough times, or if I wait long enough to open it again (like a few minutes), the spike doesn't start.

This shows the process spiking the CPU in htop

Image

Not all modifications trigger the problem, but I can reproduce the issue consistently by adding a single space to a specific file I have.

One time, while trying to figure out this issue, I noticed a CPU spike caused by a process named django-html-template-lsp, or something similar, but I haven't seen it again since.

So, I tried uninstalling the Django extension, and it worked. I don't see CPU spikes anymore after modifying HTML files.

Another thing that fixes it is disabling AI entirely and restarting.

How can I confirm it's a problem with the extension or Zed itself?

Current vs. Expected behavior

Current behavior: CPU spike after modifying HTML files.
Expected: No spikes.

Zed version and system specs

Zed: v0.227.1+stable (Zed)
OS: Linux Wayland manjaro unknown
Memory: 30.5 GiB
Architecture: x86_64
GPU: AMD Ryzen 7 7800X3D 8-Core Processor (RADV RAPHAEL_MENDOCINO) || radv || Mesa 26.0.2-arch1.1

Attach Zed log file

Zed.log

zed.log

Relevant Zed settings

settings.json
  "languages": {
    "Ruby": {
      "preferred_line_length": 80,
      "tab_size": 2,
      "language_servers": ["solargraph", "rubocop"],
    },
    "Python": {
      "preferred_line_length": 120,
      "tab_size": 4,
      "language_servers": ["!ty", "!basedpyright"],
    },
  },
  "lsp": {
    "solargraph": {
      "initialization_options": {
        "diagnostics": true,
        "formatting": true,
      },
      "binary": {
        "path": "/home/pablos/.asdf/shims/solargraph",
        "arguments": ["stdio"],
      },
    },
    "rubocop": {
      "initialization_options": {
        "safeAutocorrect": true,
      },
      "binary": {
        "path": "/home/pablos/.asdf/shims/rubocop",
      },
    },
  },

  // django
  "file_types": {
    "Django": ["**/templates/**/*.html"],
  },

Relevant Keymap

keymap.json

(for AI issues) Model provider details

Changing the currently selected model doesn't change the behavior.

I'm using them via ZedPro, however.

If you are using WSL on Windows, what flavor of Linux are you using?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:needs triagetriage is not complete: no `area:*` label, or no `priority:*`/`frequency:*` for Bugs/Crashes

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions