Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Defender slowing down Electron startup

Context

I have setup a trivial Electron app which shows a plain html file and it consistently takes more than two seconds to start up. The key performance measurements are:

  • 170 ms: a blank window appears on the screen
  • 2800 ms: the window shows the specified HTML

After asking about it, I discovered that the problem is caused by Windows Defender. Disabling its real-time protection gets us an acceptable startup speed:

  • 150 ms: a blank window appears on the screen
  • 500 ms: the window shows the specified HTML

While this speedup solves the problem completely, it is a no-go to ask users to disable Windows Defender in order to have faster startup.

Question

I have observed some popular Electron apps, like Visual Studio Code, have normal startup time so I assume there is a way to achieve that without disabling Windows Defender. The question is: how?

The only thing that comes to my mind is signing the electron binary, in the hope that it solves the problem. But since a signing certificate costs money I'd rather be sure I need it before going down this route. It would be great if someone with experience on this area could chime in!

Requirement

I am looking for a solution that doesn't require telling my users to modify their environment.

like image 635
aochagavia Avatar asked Jun 15 '21 08:06

aochagavia


People also ask

Is Windows Defender slowing down my computer?

Another Windows Defender feature that may be responsible for slowing down your system is its Full Scan, which performs a comprehensive check of all files on your computer.

Why is the electron app so slow?

It is just the renderer, and just like a web app in a regular browser, it uses HTML, CSS and JavaScript to build an interface and provide functionality. Those are a lot of extra layers. And because of this additional abstraction, it can be slower than a finely tuned native app.

Does Windows Defender affect performance?

Developer claims that a Windows Defender bug could be sapping up to 6% of Intel CPU performance. Developer Kevin Glynn, aka "Uncle Webb," has discovered a weird Windows Defender bug that causes Intel CPUs to suffer a significant performance hit on Windows 10 or 11.


1 Answers

Your best bet would be to submit your executable to MS Defender Team as sample for review at: https://www.microsoft.com/en-us/wdsi/filesubmission, mention in comment your issue. They are releasing defender updates almost daily basis so it should not be a big deal

One more thing you can help yourself with is to get your exe in the exclusion list of Defender AV (mostly Microsoft trusted locations are often in exclusions) so it should be no brainer.

And of course open a case with Microsoft in parallel to help you there.

like image 166
Shahid Roofi Khan Avatar answered Oct 11 '22 12:10

Shahid Roofi Khan