打开大量文件时 Windows CreateFile 速度慢 [英] Windows CreateFile slow when opening a large number of files

查看:33
本文介绍了打开大量文件时 Windows CreateFile 速度慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个包含大约 3000 个文件的目录.我知道 NTFS 线程谈到 CreateFile 在读取 100,000 或数百万数量的文件时速度很慢.我的数字几乎没有那么高,但 CreateFile 仍然需要大约 4-7 毫秒才能完成,当我打开 3000 个文件时,它会加起来.所以我的问题类似于下面的帖子.在某些机器上,当我调用 CreateFile 时它快如闪电,然后在其他机器上它是 4-7 毫秒的速度.我试过 Fat32 文件系统和 NTFS 都没有运气,两者都很慢.Win7 和 Win10 一样,都慢.我注意到的唯一共同点是速度较慢的机器似乎在使用 SATA/RAID 控制器的机器上,而在具有标准 SATA 的机器上速度很快.所有的机器都使用 SSD 驱动器.

I am using a directory that has about 3000 files. I am aware of the NTFS threads that have talked about CreateFile being slow for reading files in the quantity of 100,000s or millions. My number isn't nearly that high yet it still takes about 4-7 ms for CreateFile to complete which adds up when I'm opening 3000 files. So my problem is similar to the post below. On some machines it is lightning fast when I invoke CreateFile and then on other ones it is this 4-7 ms speed. I've tried Fat32 filesystem and NTFS with no luck, it is slow on both. Same with Win7 and Win10, slow on both. The only commonality that I have noticed is that the machines where it is slow seem to be on machines that are using SATA/RAID controllers and fast on machines that have standard SATA. All of the machines are using SSD drives.

请注意:作为我实验的一部分,我正在做与下面线程相同的事情.我有一个调用 CreateFile 然后调用 CloseHandle 的简单程序.什么都不做,并且在某些机器上非常慢(4-7ms CreateFile),而在其他机器上速度很快,如上所述.以下线程是一个非常相似的问题,但从来没有一个好的答案.

As a note: I am doing the same thing as the thread below as part of my experiment. I have a simple program that invokes CreateFile and then CloseHandle. Does nothing else and is very slow on some machines(4-7ms CreateFile) and fast on others as described above. The following thread is a very similar question but there was never a good answer for it.

为什么windows第一次打开文件这么慢,有没有更快的方法

谢谢

格雷夫斯

推荐答案

所以我错了.我没有安装任何第三方防病毒软件,但仍然安装了 Microsoft Security Essentials.这绝对是问题所在,当 MSE 运行时 CreateFile 会变慢是有道理的.因此,如果您运行 MSE 或 Windows Defender,这会显着降低 CreateFile 的速度.

So I was mistaken. I didn't have any third party anti-virus software installed, however Microsoft Security Essentials was still installed. This is definitely the problem and it makes sense that CreateFile would be slower when MSE is running. So if you have MSE or Windows Defender running this will slow down CreateFile significantly.

这篇关于打开大量文件时 Windows CreateFile 速度慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆