KGN
January 24, 2024, 2:42pm
5
Hey Tex,
Itās a longstanding issue with Electron on specifically Windows with Windows Defender but also occurs on other operating systems with scan + protect.
You can read a bit more about it on the Electron Github if youāre interested:
opened 08:10PM - 23 Jun 21 UTC
closed 10:24PM - 28 Jun 21 UTC
blocked/need-info ā
bug
### Preflight Checklist
- [X] I have read the [Contributing Guidelines](https:/⦠/github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a feature request that matches the one I want to file, without success.
### Electron Version
13.1.4
### What operating system are you using?
Windows
### Operating System Version
Windows 10 Version 21H1
### What arch are you using?
x64
### Last Known Working Electron version
_No response_
### Expected Behavior
The first file, referenced by `index.html` (loaded by `main.js`) loads as fast as the files after the first file or at least much faster.
### Actual Behavior
The `main.js` loads a file `index.html` that itself references a style sheet and a JavaScript file:
```js
function createWindow() {
_mainWindow = new electron.BrowserWindow()
_mainWindow.loadFile(path.join(__dirname, "index.html"))
_mainWindow.on("closed", () => _mainWindow = null)
}
```
The style sheet that is referenced first takes around 1.7 seconds to load while following files take only like 1ms to load. The start up time of my Electron app is delayed by this 1.7s because of this. I don't know where this delay comes from and how to fix this in the user code.
See the output of my test application:
```
$ npm start
> electron-performance-issue@1.0.0 start D:\electron-performance-issue
> electron .
Loading: file:///D:/electron-performance-issue/app/index.html (14 ms since last load)
Loading: file:///D:/electron-performance-issue/app/index.css (1775 ms since last load)
Loading: file:///D:/electron-performance-issue/app/index.js (0 ms since last load)
```
I considered using Webpack but
- The [electron-webpack-quick-start](https://github.com/electron-userland/electron-webpack-quick-start) uses old dependencies and I didn't manage it yet to get it running with current versions
- I like to keep out this additional dependency and configuration effort
### Testcase Gist URL
_No response_
### Additional Information
I made a repository with the minimal code for this issue: https://github.com/c3er/electron-performance-issue
opened 06:39AM - 11 Feb 22 UTC
closed 03:53PM - 28 Mar 23 UTC
question
Application is taking nearly 90 seconds to start, post installation. Using Elect⦠ron latest version and .Net Core 5
So the āWhy is it not other applicationsā reason is āmost of your applications are not Electron on that computerā.
Itās obviously something weāre aware of but unless either a fix is pushed upstream or we swap off Electron to an alternative itās something weāre stuck with for now. There are alternatives for at least Windows (disabling Smartscreen Defender) but Iāve personally not looked deeply into Mac solutions.
1 Like