Skip to content

CPU usage even when idle (due to cursor rendering) #22900

@joliss

Description

@joliss
  • VSCode Version: 1.10.2 (8076a19)
  • OS Version: macOS Sierra 10.12.3

VS Code uses 13% CPU when focused and idle, draining battery. This is likely due to the blinking cursor rendering. I think CPU usage when focused-and-idle could ideally be near-0%.

To reproduce (this works with an empty settings file and all plugins disabled):

  1. Close all VS Code windows.
  2. Open a new window (File -> New Window). It will show the Welcome page.
  3. Open a new tab with an empty untitled file (File -> New Tab). The cursor is blinking.
  4. You should see VS Code consuming a non-negligible amount of CPU -- 13% on my 13" MacBook Pro.
  5. Cmd+Tab into some other application. Now the cursor isn't visible anymore.
  6. You should see VS Code consuming virtually no CPU.

I recorded a Timeline in the Developer Tools, and a cursory look suggests that the CPU activity comes from rendering the blinking cursor every 500ms.

Other macOS applications like Chrome or TextEdit show a blinking cursor without consuming much CPU, so I think this could surely be optimized away.

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bugeditor-coreEditor basic functionalityperf

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions