Re: Is there a *much* faster FSRef conversion than CFURLCreateFromFSRef()?
Re: Is there a *much* faster FSRef conversion than CFURLCreateFromFSRef()?
- Subject: Re: Is there a *much* faster FSRef conversion than CFURLCreateFromFSRef()?
- From: Thomas Engelmeier <email@hidden>
- Date: Wed, 13 Sep 2006 13:37:58 +0200
On 12.09.2006, at 16:57, Alan Smith wrote:
I'm using FSRefs to make a speedy directory enumerator. When I
"sampled" it with Shark I found, to my dismay, that the slowest part
was CFURLCreateFromFSRef(). Actually the slowest function was
FSRefMakePath() which CFURLCreateFromFSRef() uses. After googleing in
hopes of finding a faster way I was forced to stick with the slow
FSRefMakePath(). I say it is slow because in an enumeration test of
/Applications 22% of the time was spent in that function, which (IMHO)
is too long.
And perfectly reasonable that it is slooooooooow. A FSRef is
something you might think of as an opaque inode (http://
en.wikipedia.org/wiki/Inode - OK, probably something similiar for HFS
+), and to build an URL from that the OS needs to
1. get the UTF string associated with the inode
2. get the parent inode and insert it's name
3. repeat 2 until it there is no parent dir
So while dir enums with FSRefs is fast ("gimme all child nodes of
that inode") converting to URLs is slow because for each node there
needs there is an traversal all the way up.
You might save time by fetching the directory URL only once and then
use the URL and get / append the HFSUniStr255 to form the paths.
Regards,
Tom_E
_______________________________________________
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