Node.js Electron Applications for Single Core Windows 7 machines are slow on file I/O

I'm running an electron application on a single core windows 7 machine. It seems whenever I do almost any file I/O with the fs library, the CPU spikes to ~100% for the electron process and it can take up to a minute to perform the file I/O.

One function that is particularly slow is fs.readFileAsync(). The file I'm reading is very small, but it seems to take a really long time to perform.

I've also run this exact code on Windows 7 with dual core, Windows 8.1, Windows 10, and Ubuntu 15.10, and none of these operating systems run into this problem, it only seems to be single core windows 7 machines. (So I'm almost positive there is no problem with the code written).

Does anyone know why this could be happening? Is there any solution to this problem? It seems odd that the number of cores affects an electron application's performance. Again this is only Windows 7 though, so single core windows 8.1, or Windows 10 machines do not exhibit this behavior.

Answers


Electron does not handle task like that well in the main process. Electron is also not multi-threaded.

Even though you are running single core, I would recommend using node's "child_process" to run file read/writes(or any heavy task for that matter) outside of electron's main process. This should solve any strange hiccups or stutters in the app and generally does speed things up.

Also keep in mind that electron is based on chrome and node is based on v8 which is chrome's core. These things combined make electron very resource intensive by nature and performance is generally the downside of electron. The upside obviously being able to quickly create cross platform apps. A 1 core machine just overall is probably not well suited to run even 1 electron app. We haven't had 1 core machines in what? 10 years?


Need Your Help

JavaScript value not set during form submit

javascript forms post

I've searched for a solution to this issue all over the web. After no success, here I am. I have a form that where I have 3 fields that should contain data. Field 1 is the Zip Code, Field 2 and 3 are