Electron app is extremely sluggish on Mac


#1

I have buil my app on an ubuntu system and am now testing it on a Mac system. I find that the app runs extremely sluggish on the Mac. E.g.

You can see how sluggish the cursor is. Not just this, other actions which cause the UI to change, are also bad. For example, on click of a button , a certain div is shown and another hidden. However, on the mac, the new div is shown on top of the old one, and only after a few seconds if I move the mouse over some of the controls does the old div go away. This behaviour is not observed in the app with the same code on Linux.

I am using React to build my app, however, for something as simple as a Note taking component, I would not expect React to be the cause of this issue on Mac.

How do I go about pin pointing why the app behaves so slow on the mac?


#2

I just came across the an incredibly unexpected behavior. To dig deeper into the issue I was using the Timeline feature of Chrome dev tools. When I captured a new timeline with Screenshots enabled, the sluggishness went away. However, capturing with just JS profile the sluggishness was still there.

Also, there doesn’t seem to be much difference between the 2 sets of timeline data captured.

Why could this be happening?


#3

Bump. Did you come across any insights to date?


#4

Yesterday I saw a little sluggishness running my Electron app in VirtualBox Linux Mint. Whenever the cursor went over an item with a changing CSS hover state the cursor would freeze for a split second and the CSS changes would be slow, causing very janky movement when moving the cursor around the screen. It only happened on my app window, not the rest of the virtualised desktop. Also, this didn’t happen previously in the host’s linux system.

However, when I woke the virtual from suspend today I notice the cursor is now corrupted (wasn’t like that yesterday, probably X11 server messed up on resume) so I logged out to restart X11. Now the janky cursor doesn’t happen. Weird. Seems like Electron reacts to subtle hidden problems which aren’t obviously visible. I can see many developers going nuts over this. :confounded:


#5

Yes. What I noticed was that certain versions of electron were not working fine on that specific version of Mac OS, which was 10.10.4. The same app was working fine in higher versions of Mac OS. What I understood was that some versions of Chromium have these sluggish rendering issues on Mac. There were some threads on Chromium Google group similar to this issue, but I don’t have the links with me right now.

What I wanted to do next was test different versions of electron on different versions of Mac and see which version is compatible and where does it break. However, I had to return the Mac I had borrowed for testing and now I don’t have one with 10.10.4 so I haven’t been able to get to the bottom of this issue.


#6

I suppose you could try installing OS X inside VirtualBox:

Although I was not successful at this in the past - OS X just hung and wouldn’t boot properly. Also running it as a virtual may invalidate your conclusions compared to someone running it normally on a Mac.


#7

Well this is unsettling. There must be some sort of workaround. Do we have any idea why Chromium is rendering slow on later versions of OS X?

On a related note, Chrome (Version 56.0.2924.87) renders everything very fast in browser.