Skip to content

High idle CPU from infinite CSS animations and cursor blink #39

Description

@navedr

Problem

Switchboard consumes ~53% CPU with just 2 idle terminals (at shell prompt, no output). This causes noticeable heat and battery drain on laptops.

Root Causes

1. Cursor blink (fixed in PR #36)

cursorBlink: true in xterm options forces a WebGL repaint cycle every ~500ms per terminal. With multiple idle terminals, this keeps the GPU process and renderer constantly active.

2. Infinite CSS animations

Several sidebar/grid elements use animation: ... infinite which forces Chromium's compositor to run at 60fps even when nothing is visually changing:

  • .slug-group-dot.runningpulse-dot 2s ease-in-out infinite
  • .grid-card-dot.busypulse-dot 1.5s ease-in-out infinite
  • .session-item.needs-attention .session-status-dot::before/::afterripple-out 2s ease-out infinite
  • .session-item.cli-busy .session-summaryshimmer-text 3s linear infinite

Each infinite animation costs ~5-10% CPU per visible animated element due to continuous composite passes.

Resolution

Replacing infinite animations with static visual equivalents (solid glow, static ring, static color) while keeping the transient spin-dot animation for cli-busy state:

Element Before After
Running session dot Pulsing opacity Solid green + glow
Grid card busy dot Pulsing opacity Solid green + glow
Needs-attention dot Expanding ripple rings Static orange ring
CLI-busy summary text Shimmer gradient sweep Static blue color

Results

State Before After
2 idle terminals ~53% CPU ~3% CPU
No terminals ~1% ~1%

Tested on macOS M2 Max with Switchboard v0.0.28+.

PR #36 addresses cursor blink. The CSS animation fixes are available in navedr/switchboard@5727325 if you'd like to pull them in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions