I want to create a large file (several GB!). I have used CreateFile, SetFilePointer, WriteFile and CloseHandle to achive this, but it takes a long time.
How can I speed this up?
/Delight
How can I speed this up?
/Delight
With a faster harddisk :grin:
Or perhaps direct file system writing :-)
(Sorry, could not resist)
Or perhaps direct file system writing :-)
(Sorry, could not resist)
If you want to create a large file than it MUST have it's purpose this meens that you have something to write in that file .(Right ? than what is the file for ? Do you have to write the file more than once ?)
That meens you can not write faster than it's phisicaly (system speed ) possible (if HDD is fragmented).
If the HDD your writing at is empty then you could optimize some proc to alocate the space for the whole file .
And after that write the data. The best scenario would be to have your own internal file structure to acces your data by asm code directly (phisicaly) . Your own internal structures in the file can be optimized .
Conclusion (Tell more to let us know the whole problem )
That meens you can not write faster than it's phisicaly (system speed ) possible (if HDD is fragmented).
If the HDD your writing at is empty then you could optimize some proc to alocate the space for the whole file .
And after that write the data. The best scenario would be to have your own internal file structure to acces your data by asm code directly (phisicaly) . Your own internal structures in the file can be optimized .
Conclusion (Tell more to let us know the whole problem )
I want to do some experiments with the up/download speed of files of different sizes and with mixed content (empty/random data/...).
I read somewhere that the download speed is increased several times if the file being downloaded is empty. I also want to check if the same thing happens in a local network.
/Delight:grin:
I read somewhere that the download speed is increased several times if the file being downloaded is empty. I also want to check if the same thing happens in a local network.
/Delight:grin:
The fastest way to create a big file I can think of is using SetFilePointer and SetEndOfFile. The file's content can then be pretty much anything, though.
The download speed being faster for an empty (but not zero length) file is do to compression by the TCP/IP stack; maybe at the hardware level.
If you'r interested just in speed you could "download" the file in memory And test the speed of download . You have two posibilities :
1) Create your own program that downloads in memory or
2) Create a Ram Drive and download in that ...
1) Create your own program that downloads in memory or
2) Create a Ram Drive and download in that ...
eet_1024: compression in the TCP/IP stack? At hardware level? Both
sound pretty unlikely to me. Ok, this is often done on dialup, but not
when you're on an ethernet media.
sound pretty unlikely to me. Ok, this is often done on dialup, but not
when you're on an ethernet media.
Thank's for all the answers!
I still have a question though. What will the file contain when using SetEndOfFile? Is just old deleted files?
/Delight
I still have a question though. What will the file contain when using SetEndOfFile? Is just old deleted files?
/Delight
What will the file contain when using SetEndOfFile? Is just old deleted files?
I guess so, yes.
OK. Thank's Tola, I'll try using it
/Delight
/Delight
Why isn't this working?????????????????????
;--------------------------------------------
invoke CreateFile,CTXT("C:\MYFILE.TXT"),GENERIC_WRITE,0,NULL,CREATE_ALWAYS\
,FILE_ATTRIBUTE_NORMAL or FILE_FLAG_OVERLAPPED,NULL
mov eax,CreateFileHandle
...
invoke SetFilePointer,CreateFileHandle,4,NULL,FILE_BEGIN
...
invoke SetEndOfFile,CreateFileHandle
invoke CloseHandle,CreateFileHandle
;----------------------------------------------
Shouldn't this create a 4 bytes large file named myfile.txt in the root of c: ??????
;--------------------------------------------
invoke CreateFile,CTXT("C:\MYFILE.TXT"),GENERIC_WRITE,0,NULL,CREATE_ALWAYS\
,FILE_ATTRIBUTE_NORMAL or FILE_FLAG_OVERLAPPED,NULL
mov eax,CreateFileHandle
...
invoke SetFilePointer,CreateFileHandle,4,NULL,FILE_BEGIN
...
invoke SetEndOfFile,CreateFileHandle
invoke CloseHandle,CreateFileHandle
;----------------------------------------------
Shouldn't this create a 4 bytes large file named myfile.txt in the root of c: ??????
I guess this is just an error you made when posting?
mov eax,CreateFileHandle
If it is not then this is your problem.
KetilO
mov eax,CreateFileHandle
If it is not then this is your problem.
KetilO
AAARGH!!!!! How could I be so blind? You found the "bug" !
Thank you!
/Delight
:stupid:
Thank you!
/Delight
:stupid: