Altair: Electron version constantly using at least 15% of the CPU

Created on 13 Nov 2019  路  4Comments  路  Source: imolorhe/altair

Describe the bug
The Electron helper process constantly uses at least 15% of the CPU.
The UI also reacts really slow and is behaving laggy.

To Reproduce
Just open it.

Expected behavior
To don't use any CPU when idling.

Screenshots
image

Desktop (please complete the following information):

  • OS: macOS 10.15.1
  • Version 2.3.8

Altair is quite unusable in that state, I also can't keep it running in the background since it causes the fans to make noise.

Most helpful comment

So it turns out zone.js wasn't the root cause of the high CPU usage. It was due to several things: the codemirror refresh addon constantly refreshing the codemirror UI every 250ms, and the loading animations. After implementing the refresh addon's functionality in a more efficient manner, and stopping loading animations when there is no loading happening, the idle CPU usage of Altair has dropped down to 0%.

All 4 comments

Hey @levrik, just ran some tests and you're right.

Here are my findings:

  • Altair does use more CPU when idle than necessary (~15%), but it uses a sufficient amount of CPU when being actively used.
  • If however you minimize it or open it in a full screen where it is not being currently shown, the CPU usage goes back to normal.
  • I have narrowed down that the problem isn't from electron itself but from some functionality within the app.
  • Upon doing a simple profiling, I believe the problem is from zone.js which angular uses to manage asynchronous tasks. It is actively running in the background whenever the app is in focus.

I can also confirm that this issue wasn't introduced recently into the app, but it has always been the case. Actually the CPU usage is better now than in older versions (older versions had ~25% usage).

I would look into how to get zone.js to be better optimized when idle. In the meantime, since you've been using Altair previously, the latest version has the most optimal usage of CPU among all the versions and so you should keep using that one. Whenever you aren't using the app, you can minimize it or move away from it. That should be sufficient until the issue with zone.js is rectified. 馃檪

In a few cases, I've seen it running >60% CPU on a recent processor while idle in a different workspace.

@Macavirus did minimizing it fix it for you?

So it turns out zone.js wasn't the root cause of the high CPU usage. It was due to several things: the codemirror refresh addon constantly refreshing the codemirror UI every 250ms, and the loading animations. After implementing the refresh addon's functionality in a more efficient manner, and stopping loading animations when there is no loading happening, the idle CPU usage of Altair has dropped down to 0%.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MCSH picture MCSH  路  7Comments

rshea0 picture rshea0  路  11Comments

sneko picture sneko  路  10Comments

imolorhe picture imolorhe  路  4Comments

bsr203 picture bsr203  路  12Comments