On 10/30/05 6:06 PM, Lawrence Sanbourne didst favor us with:
> On 10/30/05, Laurence Harris <email@hidden> wrote:
>> On 10/30/05 4:03 PM, Steve Baxter didst favor us with:
>>
>>> I would use FSRefs by value here rather than storing pointers, i.e.
>>> store the actual FSRefs in the vector rather than a pointer to a
>>> FSRef. The overhead of copying 80 bytes will be so small as to be
>>> unmeasureable. You may actually find that the copy overhead is less
>>> than the malloc() overhead of allocating 80 bytes (but only Shark
>>> will tell you).
>>
>> Except it's not either/or. If you store pointers, such as is the case with a
>> CF widget or a vector of FSRef pointers, once you allocate the memory for 80
>> bytes, you still have to copy the FSRef into the allocated memory.
>
> And if you don't store pointers, then the STL has to copy the FSRef
> into some memory.
Yes, into 80 bytes of a contiguous block that's already allocated 99.9% of
the time. You aren't just storing pointers, you're allocating memory,
copying the FSRef to that newly allocated memory, and then storing a pointer
to that allocated memory into an array. And that's the overview. Since
you're using CFTypes, there's also reference count management and possibly
more going on than simply copying 80 bytes of FSRef into a newly allocated
block of memory when the CFDataRef is created (I honestly don't know what CF
does to create a CFDataRef).
Larry
_______________________________________________
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