Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?
Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?
- Subject: Re: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?
- From: JongAm Park <email@hidden>
- Date: Fri, 1 Aug 2008 19:27:53 -0700
Thank you, Jens Alfke for your reply.
The function will write about 19200 bytes per every call. I'm going
to write XDCAM 35 or 50 video data.
What is curious was that saving files as QuickTime movie format from
the Final Cut Pro takes about 20 secs for 1 minutes of XDCAM 35 video
source, but if it does so using a FCP plug-in of which source codes I
work with takes about 35 seconds. There is a call back function which
is called by th FCP, and I even tried converting it to multithreaded
version, but it is still much slower than the FCP's own scheme.
I measured the performance and found out that the most of the time
were spent with the FSWriteFork() function.
Probably other parts should be streamlined also, but it would impact
significantly if the file write can be faster.
Thank you.
On Aug 1, 2008, at 6:04 PM, Jens Alfke wrote:
On 1 Aug '08, at 3:33 PM, JongAm Park wrote:
I have some codes which were written in Carbon and we want to make
its performance faster.
I found out that most of the time is spent by a series of
FSWriteFork() function. So, I would like to use any method which
is faster than that.
fwrite is one option but I also looked up a Cocoa method,
writeData message of the NSFileHandle.
All of those end up going through the same filesystem calls
('write', primarily) in the kernel, so one's not going to be faster
than another. I would expect fwrite to be a tiny bit slower because
of the extra buffering that stdio does, and NSFileHandle will also
be a little slower because of the overhead of calling Objective-C
methods. But generally that wouldn't be noticeable.
What really makes a difference is how much data you write on each
call — the more the better. It may also help to use uncached
writes, if the file's not going to be read again soon.
The fs_usage tool can help you see what filesystem calls you're
making and how much data is being sent in every call.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden