Live data from Hacker News

VS Code uses 13% CPU when idle due to blinking cursor rendering

github.com

11–20 of 801 posts

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#11
This reminds me that as part of the Windows95 development effort, Microsoft disabled per-second updates of the taskbar clock to improve performance. Raymond Chen wrote a bit on it back in 2003:

https://blogs.msdn.microsoft.com/oldnewthing/20031010-00/?p=...

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#13

...21st century desktop application development ladies and gentlemen (not that I'm proposing anything constructive).

Throw it in the bin and return to the old ways, but with modern testing, source control, and static analysis?

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#14
It just doesn't go in my head that we are building text editors inside a web browser! I get it, there are many good use cases for Electron and it's easy to get started with cross platform support, but why is everybody going crazy about text editors in them? Because you can write plugins in JS?

Wouldn't it be better to make native application, especially for code editors, where developers spend most of their time, where every noticeable lag and glitches are not appreciated.

Edit: Many people here think that I am attacking this web based kind of technology, which I am not, and sorry for not being clear enough, but why chose something so high up the stack for dev tool?

Edit2: For non-believers in nested comments, look -> https://github.com/jhallen/joes-sandbox/tree/master/editor-p...

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#15
post #2

TL;DR: It seems to be a problem in Chromium, the relevant CSS (one second change) results in a 60hz animation cycle. Workaround: "editor.cursorBlinking": "solid"

Interesting, considering that CSS animations were supposed to be much better than JS animations in that regard. I guess a simple setInterval would actually perform better here.

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#16
I simply cannot understand why Atom and VSCode are so popular. I get that they are extensible, but is that really worth the slowdown to you? If I need more features than a text editor, I use an actual IDE.

Someone just posted some really embarassing benchmark numbers regarding this issue yesterday: https://github.com/jhallen/joes-sandbox/tree/master/editor-p...

Note that Atom and VSCode are nearly 10x slower than all the other competition, as well as simply crashing for many of the tests. To be fair, I do think Electron based desktop apps have their niche. Spotify is a perfect example. But they have no place in text editing.

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#17

It just doesn't go in my head that we are building text editors inside a web browser! I get it, there are many good use cases for Electron and it's easy to get started with cross platform support, but why is everybody going crazy about text editors in them? Because you can write plugins in JS? Wouldn't it be better to make native application, especially for code editors, where developers spend most of their time, whe…

I believe making native application for the three platforms would be considerably more effort.

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#18

It just doesn't go in my head that we are building text editors inside a web browser! I get it, there are many good use cases for Electron and it's easy to get started with cross platform support, but why is everybody going crazy about text editors in them? Because you can write plugins in JS? Wouldn't it be better to make native application, especially for code editors, where developers spend most of their time, whe…

well if you've ever built a cross platform native desktop application, you will appreciate Electron.

Java Swing. Never again.

edit: Do people downvoting even know what it's like building cross platform desktop applications using Java Swing? It's fucking awful, and that's a fact. Even the end result UI design look & feel is butt ugly. Sure you can spice things up with JavaFX but why? Do you not realize how masochistic it was back then vs now with thin web browser clients? Can't believe people are still thumping Java Swing in 2017.

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#19

It just doesn't go in my head that we are building text editors inside a web browser! I get it, there are many good use cases for Electron and it's easy to get started with cross platform support, but why is everybody going crazy about text editors in them? Because you can write plugins in JS? Wouldn't it be better to make native application, especially for code editors, where developers spend most of their time, whe…

> easy to get started

Yes.

> cross platform support

Yes.

> Because you can write plugins in JS?

Yes.

---

As much as I prefer native programs as a user, it's impossible to ignore the benefits of cross-platform development and plebeian hackability/debuggability.

Re: VS Code uses 13% CPU when idle due to blinking cursor rendering

#20
post #2

TL;DR: It seems to be a problem in Chromium, the relevant CSS (one second change) results in a 60hz animation cycle. Workaround: "editor.cursorBlinking": "solid"

I recently discovered the same issue in a webapp I develop... a simple CSS animation for a "loading" spinner was pegging the CPU. Using steps(n) with a low number basically resolves the issue. https://css-tricks.com/snippets/css/keyframe-animation-synta...

Kind of ridiculous that it's so easy to make this mistake.

Post reply on HN