Re: About efficiently reading and writing files...
Re: About efficiently reading and writing files...
- Subject: Re: About efficiently reading and writing files...
- From: John Stiles <email@hidden>
- Date: Mon, 13 Dec 2004 10:41:02 -0800
I think if you want the best performance for writing huge solid blocks
of data, try open/pread/pwrite.
If you're doing scattershot small accesses throughout the file, try
mmap.
fopen/fread/fwrite are okay, but they are really meant for tiny
accesses; I believe they break up all data accesses into 4K chunks,
even if you ask for huge blocks. As a result, you will find that the
kernel consumes a little more CPU time when you use fread/fwrite versus
read/write. I used to think the difference was irrelevant, but then I
timed it both ways and open/pread/pwrite was measurably superior.
On Dec 13, 2004, at 10:27 AM, Juan Pablo Pertierra wrote:
Hello,
My program writes(and reads) very large files from the hard drive. Do
the standard functions fwrite/fread provide the maximum level of
performance for doing these operations within a Cocoa application, or
do I need to use some other lower-level method? Should I use
NSFileHandle instead of fwrite/fread/etc functions? It is very
important that I get the maximum possible performance in writing the
files, i don't really care if the computer does nothing else when
writing.
Thanks in advance,
Juan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden