Re: Why not use path-based API? (was: Loading image resources)
Re: Why not use path-based API? (was: Loading image resources)
- Subject: Re: Why not use path-based API? (was: Loading image resources)
- From: Jens Alfke <email@hidden>
- Date: Sun, 14 Sep 2014 13:00:08 -0700
Performance is another reason. IIRC, in earlier OS X releases it turned out that there was significant overhead stemming from converting between different types of file references as a call went up and down the stack — NSString/CFString <—>NSURL/CFURL <—> FSRef <—> C strings, etc. (This may sound trivial, but it's the kind of trivial thing that can eat up CPU time inside loops or performance-critical code.) So there's been some effort to standardize on NSURL/CFURL, at least above the POSIX/kernel layer.
So I don't have numbers to back this up, but my understanding is that NSURL-based APIs will be slightly faster than NSString-based ones. Though probably not enough faster to worry about unless your code is performance-sensitive.
—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