Skip to content

Reduce agent spinner GPU usage#51756

Merged
Anthony-Eid merged 8 commits intozed-industries:mainfrom
AndPuQing:main
Apr 7, 2026
Merged

Reduce agent spinner GPU usage#51756
Anthony-Eid merged 8 commits intozed-industries:mainfrom
AndPuQing:main

Conversation

@AndPuQing
Copy link
Copy Markdown
Contributor

Closes #39532

Summary

Move the long-running agent "generating" spinner into a dedicated GeneratingSpinner view.

Previously, the generating state rendered SpinnerLabel inline as part of the full thread view. This change keeps the same spinner styling, but isolates it into its own small view so the animation no longer needs to live directly inside the larger thread UI subtree while the agent is running.

before:

image

after:

image

Testing

  • cargo run -j 4 ~/Downloads/WorkSpace/zed/
  • cargo check -p agent_ui

Release Notes:

  • Fixed high GPU usage from the agent panel's generating spinner while an agent is running.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 17, 2026
@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Mar 17, 2026
@SomeoneToIgnore SomeoneToIgnore added area:gpui GPUI rendering framework support area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features and removed area:gpui GPUI rendering framework support labels Mar 17, 2026
@cameron1024 cameron1024 self-assigned this Mar 17, 2026
Copy link
Copy Markdown
Contributor

@Anthony-Eid Anthony-Eid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI is slightly changed here

Comment on lines +4556 to +4574
.child(SpinnerLabel::sand().size(LabelSize::Small)),
.justify_center()
.child(self.generating_spinner.clone()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would change the confirmation spinner from rendering with the sand animation to the default. I don't think this is what we want here

cc: @danilo-leal For additional feedback if you have any

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

fix

@steckes
Copy link
Copy Markdown

steckes commented Mar 24, 2026

@Anthony-Eid can you re-review? Waiting for my fan not to spin up anymore, annoying my colleagues :D

Copy link
Copy Markdown
Contributor

Going to review this later today! Sorry for the delay

@steckes
Copy link
Copy Markdown

steckes commented Mar 30, 2026

@AndPuQing can you run cargo fmt?

@AndPuQing
Copy link
Copy Markdown
Contributor Author

@AndPuQing can you run cargo fmt?

done

@steckes
Copy link
Copy Markdown

steckes commented Mar 31, 2026

@Anthony-Eid could you restart the workflow? :)

@AbyssWaIker
Copy link
Copy Markdown

@Anthony-Eid sorry for bothering you, but a little reminder for when you have a time.

This is pretty important to me (and my laptop's battery)

Thank you in advance

@Anthony-Eid
Copy link
Copy Markdown
Contributor

0001-Use-window.use_state-to-clean-up-code.patch

@AndPuQing Could you please apply this patch to your PR? I tried checking out and pushing to your branch manually but I didn't have permission too.

@Anthony-Eid
Copy link
Copy Markdown
Contributor

@AndPuQing Sorry, is there anyway you could give me permission to make an edit directly on your branch? I want to fix the merge conflicts. Also, my patch was incomplete, we shouldn't be passing any of the entities for the spinners around.

window.use_state is a lot cleaner in this case, so i would prefer if we did that

@AndPuQing
Copy link
Copy Markdown
Contributor Author

@AndPuQing Sorry, is there anyway you could give me permission to make an edit directly on your branch? I want to fix the merge conflicts. Also, my patch was incomplete, we shouldn't be passing any of the entities for the spinners around.

window.use_state is a lot cleaner in this case, so i would prefer if we did that

I have enabled "Allow edits by maintainer" and I have also invited you to join my forked collaborator group.

@Anthony-Eid Anthony-Eid enabled auto-merge (squash) April 7, 2026 21:50
@Anthony-Eid Anthony-Eid merged commit 36a23c2 into zed-industries:main Apr 7, 2026
30 checks passed
@steckes
Copy link
Copy Markdown

steckes commented Apr 16, 2026

It is released! TY! :)

@AndPuQing
Copy link
Copy Markdown
Contributor Author

image

Seems like it worked well?

@Anthony-Eid
Copy link
Copy Markdown
Contributor

Seems like it worked well?

Yes, but we can still do better. Next week I'm going to see what else I can do to improve gpu usage in the agent panel because that's still high

@steckes
Copy link
Copy Markdown

steckes commented Apr 16, 2026

Awesome! Yes on Linux I still have up to 30% GPU usage just from the agent panel.

piper-of-dawn pushed a commit to piper-of-dawn/zed that referenced this pull request Apr 25, 2026
Closes zed-industries#39532

## Summary

Move the long-running agent "generating" spinner into a dedicated
`GeneratingSpinner` view.

Previously, the generating state rendered `SpinnerLabel` inline as part
of the full thread view. This change keeps the same spinner styling, but
isolates it into its own small view so the animation no longer needs to
live directly inside the larger thread UI subtree while the agent is
running.

before:

<img width="398" height="448" alt="image"
src="https://github.com/user-attachments/assets/8a56c394-f7a6-4835-b877-fbc1500d2d03"
/>


after:

<img width="524" height="597" alt="image"
src="https://github.com/user-attachments/assets/bd2e5804-dba8-49c0-a421-7dc5ba600348"
/>


## Testing

- `cargo run -j 4 ~/Downloads/WorkSpace/zed/`
- `cargo check -p agent_ui`

Release Notes:

- Fixed high GPU usage from the agent panel's generating spinner while
an agent is running.

---------

Co-authored-by: Anthony Eid <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ai Related to Agent Panel, Edit Prediction, Copilot, or other AI features cla-signed The user has signed the Contributor License Agreement first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AI: High GPU usage when agent in working

6 participants