Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron version constantly using at least 15% of the CPU #1066

Closed
levrik opened this issue Nov 13, 2019 · 4 comments
Closed

Electron version constantly using at least 15% of the CPU #1066

levrik opened this issue Nov 13, 2019 · 4 comments

Comments

@levrik
Copy link
Contributor

levrik commented Nov 13, 2019

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.

@imolorhe
Copy link
Collaborator

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. 🙂

@Macavirus
Copy link

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

@imolorhe
Copy link
Collaborator

@Macavirus did minimizing it fix it for you?

@imolorhe
Copy link
Collaborator

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%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants