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?

Posted on 2001-09-09 15:08:11 by Delight
With a faster harddisk :grin:

Or perhaps direct file system writing :-)

(Sorry, could not resist)
Posted on 2001-09-09 15:35:23 by bazik
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 )
Posted on 2001-09-10 05:31:21 by Rosky
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.

Posted on 2001-09-10 06:34:03 by Delight
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.
Posted on 2001-09-10 09:57:56 by Tola
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.
Posted on 2001-09-10 20:03:07 by eet_1024
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 ...
Posted on 2001-09-14 13:54:43 by Rosky
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.
Posted on 2001-09-15 03:41:24 by f0dder
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?

Posted on 2001-09-15 10:17:42 by Delight
What will the file contain when using SetEndOfFile? Is just old deleted files?

I guess so, yes.
Posted on 2001-09-15 10:20:57 by Tola
OK. Thank's Tola, I'll try using it

Posted on 2001-09-15 10:36:05 by Delight
Why isn't this working?????????????????????


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: ??????
Posted on 2001-09-15 17:01:04 by Delight
I guess this is just an error you made when posting?

mov eax,CreateFileHandle

If it is not then this is your problem.

Posted on 2001-09-15 17:09:53 by KetilO
AAARGH!!!!! How could I be so blind? You found the "bug" !

Thank you!


Posted on 2001-09-15 17:19:12 by Delight