Electron performance much worse than Chrome, what am I doing wrong?


I’ve just tried my project in Electron (latest using electronforge) and the performance is really bad - does anybody know why?

I enabled

app.commandLine.appendSwitch('--enable-webgl', 'true');
app.commandLine.appendSwitch('--enable-unsafe-webgpu', 'true');
app.commandLine.appendSwitch('--ignore-gpu-blacklist', 'true');
app.commandLine.appendSwitch('--no-sandbox', 'true');

The GPU report seems fine to me yet, the performance is almost 200% worse:

about-gpu-2024-02-03T18-55-33-766Z.txt.zip (12.6 KB)

CleanShot 2024-02-03 at 19.57.46
CleanShot 2024-02-03 at 19.58.33

I am sure I probably did not turn on some important flag or something as I see no reason why it should work differently than in Chrome?

Thanks for anything!

Found the issue:

If you are using create-react-app and you’re taking the production build like me and putting it into mainWindow.loadFile(...) in Electron, the build has been built using a browser selection in package.json, something like:

"production": [
    "not dead",
    "not op_mini all"

Just replaced that with

"production": [
    "last 1 chrome version",
    "last 1 firefox version",
    "last 1 safari version"

and it will fix everything.

OR better, get completely rid of create-react-app because that project is such garbage right now, it’s not even funny.

Everything works smoothly now :slight_smile:

1 Like

Wow, thanks dude, you’re a life saver!