Animated GIFs Could Be The Answer To Visual Studio Code’s CPU-Heavy Cursor

You’d never suspect the humble cursor as a source of performance issues in your IDE, but that appears to be precisely the case with Microsoft’s Visual Studio Code, a cross-platform development environment built on Electron. A few days ago, a user reported the program consuming a large number of CPU cycles when idle and tracked it down to the blinking caret.

Fortunately, going from the report on Code’s GitHub repo, the problem appears limited to systems running OS X / macOS. Still, sapping 13 per cent of your CPU’s time (if the report is to be believed) is rather concerning.

Because Visual Studio Code’s source is right there for the tweaking, a workaround is easily implemented — turning off the cursor animation. Still, it’s 2017 — surely we can make editor cursors that don’t compromise your laptop’s battery life, right?

The cursor is implemented as a CSS-animated page element, so the issue might be with Electron, rather than Code. But let’s examine this further.

Turns out the solution might be to leverage the fact Code is based on Electron. Electron is basically a combination of a Chromium (yes, the core of Google’s browser, Chrome) frontend and a Node backend, facilitating cross-platform apps with rich user interfaces.

Now, there’s one thing browsers are very, very good at when it comes to animations and that’s the humble GIF. So, one suggested fix is to replace the cursor with an animated image. You can see an example here.

It’s one of a number of proposed solutions, with the issue unresolved at the time of writing. Still, I reckon the boffins at Microsoft — or someone in the open source community — will come up with something.

But my bet is on the GIF.

CPU usage even when idle (due to cursor rendering) [GitHub]


The Cheapest NBN 50 Plans

Here are the cheapest plans available for Australia’s most popular NBN speed tier.

At Lifehacker, we independently select and write about stuff we love and think you'll like too. We have affiliate and advertising partnerships, which means we may collect a share of sales or other compensation from the links on this page. BTW – prices are accurate and items in stock at the time of posting.

Comments


Leave a Reply