Hello,
we are testing performance of a file system filter, and the test tool uses
both crt fread and ReadFile from Windows. We have huge files (in GBs) and we
do a sequential 1 byte read to traverse the file (in one of the test cases).
We find that the ReadFile API is way faster than the fread implementation.
On 8/20/11, A P wrote: > Hello, > we are testing performance of a file system filter, and the test tool uses > both crt fread and ReadFile from Windows. We have huge files (in GBs) and we > do a sequential 1 byte read to traverse the file (in one of the test cases). > > We find that the ReadFile API is way faster than the fread implementation. > > Am I missing something here? or is this expected? > > thanks > > AP > > — > NTFSD is sponsored by OSR > > For our schedule of debugging and file system seminars visit: > http://www.osr.com/seminars > > To unsubscribe, visit the List Server section of OSR Online at > http://www.osronline.com/page.cfm?name=ListServer
fread() does buffering and calls _filbuf(), which is a wrapper around read(), which is a wrapper around ReadFile.
fread() for 1 byte is just *dst++ = *src++ and should be much faster then ReadFile, but fopen() can call CreateFile with caching flags other then the ones used in ReadFile test.
wrote in message news:xxxxx@ntfsd… IIRC fread has an extra buffering of the data (for case you want to read per character) and calls ReadFile internally. Check out CRT sources.
P?edm?t: [ntfsd] CRT fread vs Windows ReadFile Datum: 19.8.2011 - 21:44:59
> Hello, > we are testing performance of a file system > filter, and the test tool uses > both crt fread and ReadFile from Windows. We have > huge files (in GBs) and we > do a sequential 1 byte read to traverse the file > (in one of the test cases). > > We find that the ReadFile API is way faster than > the fread implementation. > > Am I missing something here? or is this expected? > > thanks > > AP > > — > NTFSD is sponsored by OSR > > For our schedule of debugging and file system > seminars visit: > http://www.osr.com/seminars > > To unsubscribe, visit the List Server section of > OSR Online at > http://www.osronline.com/page.cfm?name=ListServer >