From: Le Chaud Lapin on 23 Oct 2009 23:56 On Oct 22, 8:03 am, "Paul Baker [MVP, Windows Desktop Experience]" <paulrichardba...(a)community.nospam> wrote: > If it's sequential, consider using FILE_FLAG_SEQUENTIAL_SCAN. > However, the only way to truly know what the performance is is to measure > it, as Mihai said. See if any of the above things help. Don't forget to > reboot between tests and repeat them multiple times to ensure you are > getting consistent results. I believe SysInternals has a tool that clears > the system cache, but rebooting is easy and eliminates some other possible > causes of interference too. I measured it, and it was the ReadFile calls. Basically all the instructions between SYSENTER and actual buffer fill. 43,000,000 4- byte/500-byte/etc. reads are not good. > If you want to "slam" the entire file into memory, why not use a memory > mapped file? I did. :) Performance is now 9x what it was before, on reads only, but that's including testing in Release mode instead of Debug mode, double construction in a C++ class, and some minor optimizations. [I have "Don't forget to optimized this." comments everywhere in my code!] There is one catch of course: On writing, the file system must be predetermined with MMIO, which is not possible in my case, so at some point I will have to use the user-mode buffer technique anyway. -Le Chaud Lapin- |