Zulip-desktop: Constant large CPU use

Created on 13 Jul 2017  Â·  34Comments  Â·  Source: zulip/zulip-desktop

I'm running 1.2.0-beta on Linux.

The app is burning a surprising amount of CPU -- when nothing in particular is happening, it's about 35-40% of a core for a zulip --type=gpu-process process, and another 25-30% for a zulip --type=renderer process. Plus 20-25% for my gnome-shell, which in my experience is usually triggered by a browser tab or some other app doing a lot of work, so that's roughly 80-90% of a core consumed directly or indirectly by the app.

This was true shortly after first installing and using the app, and still true when I looked again a couple of hours later.

High more-information-needed

All 34 comments

Well, it only takes 0.6% of total CPU usage on my mac. Which platform are you using? However, I assume it's an upstream bug from Electron, rather than Zulip...

Can you use the JavaScript profiling tools in the DevTools to see what what costs such a huge amount of CPU usage?

I have to close this since it's an upstream issue and there is not much we can do about it. I hope electron team fixes these performance issues soon.

I don't think we should close this yet. At least, it's not clear to me that we've proven it's an upstream issue through profiling (it could easily be some bug on our part), and even if we know it is, we should at least be opening an upstream bug report, and trying to encourage upstream to work on it.

Well, @gnprice can you still reproduce this now?

This is probably because of memory leaks and to confirm exactly we need to use devtools Head Snapshot or Allocation Timelines under Profiles tab. if not it should be upstream bug.

More info on how to identify memory leaks here https://developers.google.com/web/tools/chrome-devtools/memory-problems/

It's not just a affecting the CPU. With Win10 16299 I have a constant GPU usage of 8-10% on a Nvidia GeForce GTX 1050
Nvidia GeForce GTX 1050

As for suspecting upstream (all when idle):
Github Desktop has no CPU or GPU activity whatsoever.
Visual Studio Code around 0% CPU usage.
Whatsapp Desktop: no CPU or GPU when minimised, 0-2 % when Window is visible.
Wire Desktop: 0%
Signal Desktop: mostly tending towards 0%

After watching these apps for 15 minutes I would guess that it might be related to how active the content is that is displayed. Whatsapp is more active than Wire or Signal which don't display whether someone is online. VS Code and Github Desktop have no activity, hence 0% when idle. Zulip is never idle: buddy list, unread msgs somewhere, new msgs etc.

When I switch to our company server (which is dead right now) and remove chat.zulip.org it's the same surprisingly. However, just scrolling through home or even just hovering the mouse of the window make the CPU leap to 40% and GPU 15+%. Feels extreme.
On scrolling the other electron apps it not quite as high. Whatsapp is best with 10-15%.

@penCsharpener thanks for digging into this. All the apps you have mentioned are using electron v1.7.9 which is the latest release. I have updated the same and will release a beta. Let's see if it makes a difference.

I have to add that on an Intel Core i5 7xxx I only have 0.2-0.6% but at times even 0%. Haven't tested yet on my old quad core. I guess that newer processors handle Zulips load more efficiently than my old machine (8 years nearly).

for the record: my old machine has an Intel Core i5 CPU 760 @ 2.80GHz in 45nm which might be a contributing factor that it's such a relatively high CPU load.

update: running latest version of zulip-electron master and I'm seeing 10-12% CPU load and ~14% GPU load all the time - that's on the new machine!! So updating to electron 1.7.9 hasn't really helped.
I noticed that there were some custom gif emojis on the page. After navigating to a PM without any the CPU load when down to 4-5%, GPU 9-10%.
gifs seem to be a contributing factor.

Interesting. Can you share the data of CPU and GPU load when there is no org added?

with no org and just a blank zulip-electron I still see 4.6% CPU, 10-12% GPU.

If the result of this is specific module or heavy computation we can move it into a web worker but it has its own limitation specially with electron. You can't access dom at all it just for computation. Once the task is done it can send the result back to browser script.

another important clue (wonder why I didn't notice before):
when you minimise the desktop app to the taskbar the CPU and GPU load drop to 0% unless you get a message etc. So the whole work is caused by updating the UI.

I guess it's the same for any electron apps i.e. 0% load on minimising the app.

I am using the Zulip desktop app 1.70 connecting to chat.zulip.org with no other Zulip connections and I am seeing similarly high-CPU utilization. Host OS is MacOSX Mavericks 10.9.6, Core i7 quad-core Macbook-2016 .

zulip_desktop

Minimizing the desktop app (at least on OSX) does reduce the CPU load ; but it's still quite high:

minimized_zulip

Minimizing the desktop app (at least on OSX) does reduce the CPU load ; but it's still quite high:

@sunrez It shouldn't be that high at least on a minimise state . On macOS High Sierra 10.13.2 Beta -

image

Can you do the following -

  • Open Activity monitor
  • Search Zulip
  • Minimize Zulip app
  • Wait for 2-3 mins
  • Paste a screenshot?

@penCsharpener @gnprice @akashnimare Can you give this a try once more?
On Ubuntu 16.04 and Desktop app 1.9.0 I am observing 0% CPU usage on minimising the app and about 1-2% with the app open. This is without any GPU.

I'm on windows. the percentages are also dependent on the number of cores you have (at least in windows task manager). The more cores the less the CPU percentage. Also applies to older vs newer CPUs.

Yeah, I think no. of cores heavily affect the performance.

@penCsharpener Could be true. I am on 8 cores.
Can you still reproduce this? If yes could you also update with your machine specs? Cause I'd like to investigate this issue.

@penCsharpener for context, the latest release of the app included an update to the underlying chromium that fixed the performance issues of this form in the app that we could reproduce. So the question here is whether it also fixed the ones you had.

Using the latest release 2.0 on a Core i5 8600K (6 cores) I still have an average of 2% uages on the CPU and if I just mouse hover over it a little the window it jumps to 15%.

Does that happen if you hover repeatedly? We do have an on-focus handler that does some work (e.g. to notify other clients that you're online and update your own presence display), so that test is likely to give the wrong idea for what the general CPU usage is.

yes, you are right. But it appears high anyway but that's the case with almost all software.

@timabbott I can observe 4-6% CPU usage on hovering on the already parts. While I can report around 12-14% usage when the app loads/reads messages (i.e. scrolling upwards/downwards fast to load Message) and around 7-10% when scrolling (both mouse and keyboard) at a slow/normal speed. With the app open and no mouse activity, 0-2% usage is observed. These usages seem normal to me as this is the same amount of CPU usage Chrome generates in these behaviours on the webapp.

However, I'd be interested to know what results @penCsharpener can generate on the scrolling behaviour owing to the processor and core difference.

Other than these I don't see any major usage as the older reports.

Could this have been due to the bouncing question mark hotspot animation, which we recently fixed to be more resource friendly (zulip/zulip#13760)?

This could be one of the reasons for sure. Now that we have upgraded electron to v8, it would be interesting to see the CPU usage.

It's more likely to have been some other browser bug, but in any case it's
likely long since fixed and we should close this.

-Tim Abbott (mobile)

On Tue, Mar 24, 2020, 02:37 Akash Nimare notifications@github.com wrote:

This could be one of the reasons for sure. Now that we have upgraded
electron to v8, it would be interesting to see the CPU usage.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/zulip/zulip-desktop/issues/213#issuecomment-603132004,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAU6NWSFHYFHZNYTRTI7UD3RJB5NPANCNFSM4DSZMWTA
.

@andersk The tour animation did seem to be the culprit.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brainwane picture brainwane  Â·  5Comments

Mentalone picture Mentalone  Â·  10Comments

LeSeulArtichaut picture LeSeulArtichaut  Â·  3Comments

timabbott picture timabbott  Â·  9Comments

abhigyank picture abhigyank  Â·  4Comments