On 10/29/05 2:30 PM, Lawrence Sanbourne didst favor us with:
> On 10/29/05, Laurence Harris <email@hidden> wrote:
>> On 10/29/05 11:54 AM, Lawrence Sanbourne didst favor us with:
>>
>>> I agree, there's no need for random access, and that's why I proposed
>>> a linked list. The extra space needed for the links is trivial; STL
>>> vectors would definitely use more memory. They also have O(1) access
>>> time, but this access time is likely to be slower than accessing array
>>> or a linked list that you're in the middle of traversing [both O(1) as
>>> well, but faster time-wise].
>>
>> None of these considerations is significant in and of itself IMO. Before any
>> really useful discussion can take place we'd need to know how large you
>> anticipate this list of items to grow and how you'll use it. If we're
>> talking about 10 items, none of this is significant and I'd use the approach
>> that was easiest to implement. If If we're talking about 100,000 items, then
>> these issues become relevant and how you will build and use the list become
>> relevant factors in determining which approach is best.
>
> For my application, there will usually be no more than 3 FSRefs (!),
Well, that's definitely not many. I get more than that in a list of my
mounted volumes and an "empty" folder can contain that many items. LOL
> but I wanted to write this code so it would be reusable by me and
> others.
Then you need to make a reasonable guess as to how they would use it.
>
>> Most of my code has
>> to be prepared for large lists of FSRefs which I typically access in loops
>> or as a FILO stack, so I have all the code I need to use STL vectors and my
>> own handle-based equivalent. If you have linked list code already written to
>> do this and it meets your needs, by all means use it.
>
> I don't have the code written already, but it wouldn't be very hard to
> write it. I'm happy with the performance of CFMutableArray, though.
For three items I don't think it would be possible to find something with
bad performance. ;-) On today's hardware I'm not really sure how large your
lists would have to be for the user to be able to even detect a difference
in performance.
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