gpt4 book ai didi

windows - 为什么 Windows Defender 会延迟我们软件的启动?

转载 作者:行者123 更新时间:2023-12-05 06:23:24 26 4
gpt4 key购买 nike

我正在努力帮助 SuperCollider community尝试了解我们如何防止 Windows Defender 在最新的 Windows 10 上延迟执行其中一个可执行文件。

original github issue can be found on github .

这是测试用例:

  1. download the latest version of SuperCollider for Windows x64 (3.10.3)

  2. 安装它

  3. 重启电脑

  4. 打开“cmd”并启动scsynth.exe

cd "\Program Files\SuperCollider-3.10.3"
scsynth.exe -u 57110

你将不得不等待 50 到 60 秒才能看到 scsynth 输出,它应该以类似

的内容开头
Device options:
- MME : Mappeur de sons Microsoft - Input (device #0 with 2 ins 0 outs)
[...]
SuperCollider 3 server ready.
  1. 请注意,如果您退出 scsynth.exe 并再次运行命令,scsynth.exe 会立即启动,不会延迟

  2. 现在将 scsynth.exe process 放入 Windows Defender 排除列表中(有关如何访问此排除列表的信息,请参阅 this article)

  3. 重启

  4. 打开“cmd”并启动scsynth.exe

cd "\Program Files\SuperCollider-3.10.3"
scsynth.exe -u 57110

现在 scsynth.exe 立即启动。

此行为在 Windows Defender block at first sight 时开始添加了功能。

它给 SuperCollider Windows 用户带来了很多问题。

谁能帮我们规避这个问题?

最佳答案

我猜你期待微软在这里给出一个真正的答案,但这可能会在评论中丢失,它可能对 SC 用户注册为答案有用的足够信息,所以:

经过更多的实践经验,当您从非系统位置 运行 SC 时会发生什么(即不要安装到 Program Files,也可能不会安装到系统驱动程序)稍微复杂一点。对于非系统位置,您仍会通过 Defender 对其进行扫描,启动速度非常慢,但每次机器启动仅扫描一次。然而,如果 SC 安装到 Program Files,它会在每次 SClang 进程启动时被扫描(但不会在相同的 sclang 进程运行时重新编译 classlib),除非手动添加 Defender 异常路径。

据我所知,上面的代码仍然启用了第一眼阻止,因为 MS 说“要禁用第一眼阻止,请关闭云提供的保护或自动提交示例”。我仍然启用了这两个功能。

因此,如果您不经常重启您的 PC 而只是使用挂起/恢复,如果您将 SC 安装到非系统位置...用于常规用途,这不是什么大问题。毫无疑问,它仍然为新的 SC 用户提供了糟糕的开箱即用体验。


事实上,微软今天证明了上述理论有点错误。我刚刚有一个 Windows 更新使我的机器重新启动,所以我完全预计下一次 SC 启动会再次变慢......但事实并非如此!

因此,Defender 似乎保留了最近使用和扫描位置的持久缓存,这意味着它保存在磁盘上。所以下一个问题是什么实际上可能使这个缓存无效。最后一次没有导致长时间扫描的重启仅用于 Windows 每月更新,但不包括 Defender 引擎或定义更新。因此,我认为 Defender 缓存可能会因某些更具体的事件而不是任何重启而失效。也许有一些直接基于时间或 LRU 的条目到期,但很难测试这一点,因为 Defender 经常更新自身,造成混淆。

是的,在对后一个问题进行快速搜索后,Defender indeed 在磁盘上保留了一些与之前扫描有关的信息的持久缓存。

When Real-time protection is turned on, after about 20-30 minutes it creates hundreds/thousands of files in this location:C:\ProgramData\Microsoft\Windows Defender\Scans\History\Store

Most of these files are either 1kb or 2kb. Over a 24 hour period we ended up with roughly 950,000 files and it was taking 30 GB of space.

顺便说一下,那些 Defender 历史文件太多的问题当时(2021 年 5 月)已经修复

This issue is current a known issue and the fix will be hit all release ring in this Thursday. The RCA is Engineer of MsMpEng.dll has some issue and causing lots of files in this folder. The affected engine version is 18100.5.

但肯定是一些扫描历史信息仍保留在磁盘上,这确实在很大程度上缓解了重新扫描程序(如 SC)的问题刚安装SC时的box场景。


旁白:有点好笑,但 it appears Defender 扫描速度减慢有时会影响 Microsoft 自己的产品。

programming solutions 领域:

As far as I can tell, as long as Windows Defender (and presumably other A/V scanners) are running, there's no way to make the Windows I/O APIs consistently fast. You can disable A/V scanning (at your own peril). But the trick that Mercurial employs (which has later been emulated by rustup among other tools) is to use a thread pool for calling CloseHandle(). Even if you perform all file open and write I/O on a single thread and use a background thread pool only for calling CloseHandle(), you can see a >3x speedup in time to write files. This optimization should ideally be employed by any software that creates or mutates as little as a few hundred files on Windows. This includes version control tools, installers, and archive extraction tools. Fun fact: rustup can extract tar files on Windows faster than open source and commercial fast extraction/copy tools because it employs this trick and more. I believe rustup on Windows is actually faster at extracting tar archives than it is on Linux!

也有 rustup 开发者在 youtube 上发表演讲,例如 this one

关于windows - 为什么 Windows Defender 会延迟我们软件的启动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58383531/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com