winapi - optimization of sequential i/o operations on large file sizes -
compiler: microsoft c++ 2005
hardware: amd 64-bit (16 gb)
sequential, read-only access 18gb file committed following timing, file access, , file structure characteristics:
18,184,359,164 (file length)
11,240,476,672 (ntfs compressed file length)
time file method disk 14:33? compressed fstream fixed disk 14:06 normal fstream fixed disk 12:22 normal winapi fixed disk 11:47 compressed winapi fixed disk 11:29 compressed fstream ram disk 10:37 compressed winapi ram disk 7:18 compressed 7z stored decompression ntfs 12gb ram disk 6:37 normal copy same volume fixed disk
the fstream constructor , access:
define buffersize 524288 unsigned int mbytes = buffersize; char * databuffer0; databuffer0 = (char*) malloc (mbytes); datafile.open("drv:/file.ext", ios::in | ios::binary ); datafile.read (databuffer0, mbytes); the winapi constructor , access:
define buffersize 524288 unsigned int mbytes = buffersize; const tchar* const filex = _t("drv:/file.ext"); char readbuffer[buffersize] = {0}; hfile = createfile(filex, generic_read, file_share_read, null, open_existing, file_attribute_normal, null); if( false == readfile(hfile, readbuffer, buffersize-1, &dwbytesread, null)) { ... for fstream method, -> 16mb buffer sizes not decrease processing time. buffer sizes beyond .5mb fail winapi method. methods optimize implementation versus processing time?
did try memory-mapping file? in test fastest way read large files.
update: here's old, still accurate description of memory mapped files: http://msdn.microsoft.com/en-us/library/ms810613.aspx
Comments
Post a Comment