Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FSDirectorySize code finished



On 10/30/05, Laurence Harris <email@hidden> wrote:
> On 10/30/05 1:28 AM, Lawrence Sanbourne didst favor us with:
>
> >> A few thoughts:
> >>
> >> - The CFArray approach doesn't seem very efficient since for each directory
> >> you add to the array you have to create a CFDataRef, and then later in the
> >> same function reverse the process by calling CFDataGetBytes.
> >
> > This is my way of copying the FSRefs. I  have to copy them instead of
> > storing their memory addresses because they are in the array, which I
> > keep reusing during the loop. This was the cause of the error I wrote
> > to carbon-dev about originally.
>
> I had a feeling it might be something like that, which is why I originally
> suggested using something that didn't involve CF.

Do the STL stacks, vectors, and other collections automatically copy
the memory referenced by a pointer? This would surprise me.

> > The STL is software, just as Core Foundation is.
>
> True, but what evidence do you have that CF is faster?

I know CF is "faster" only in that I don't have to rewrite anything!

> In any case, don't
> get fixated on STL. If you don't like or want to use STL, that's fine. It
> would be simple enough to write code for an efficient stack that would do
> the same thing. You're just storing a bunch of 80-byte structs. Nothing is
> going to be more efficient than copying them to or reading from slots in an
> array.
>
> My code:
>
> folderStack.push_back( fsRefArray[ idx ] );

This code (internally) still has to allocate some new memory, use copy
the stuff at the FSRef * to it.

So, I'm well aware of the convenience of the STL, but I have no reason
to believe it's faster than CF.

Larry
--
Larry Sanbourne
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: FSDirectorySize code finished (From: Lawrence Sanbourne <email@hidden>)
 >Re: FSDirectorySize code finished (From: Laurence Harris <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.