Re: Fastest way to replace characters in string
Re: Fastest way to replace characters in string
- Subject: Re: Fastest way to replace characters in string
- From: Thomas Wetmore <email@hidden>
- Date: Thu, 22 Aug 2013 13:57:46 -0400
Steve,
I apologize that what I wrote wasn't clear. Pre-allocation simply means to allocate space BEFORE you need it. And all that means is that the FIRST allocation doesn't occur at init time, but WAITS until you actually put something in the string or container. From that point of view pre-allocation is NEVER required. As I said, the capacity argument MUST BE RESPECTED at the point of the first allocation, whenever that occurs, and at all following re-allocations. My assumption has always been that the capacity increment of each subsequent allocation may grow from the initial capacity size.
Tom Wetmore
On Aug 22, 2013, at 1:43 PM, Steve Mills <email@hidden> wrote:
> On Aug 22, 2013, at 12:31:55, Thomas Wetmore <email@hidden>
> wrote:
>
>> Pre-allocation doesn't really matter as long as the re-allocations, whenever they occur, respect the capacity argument.
>
> Sure they do. If you don't preallocate, but instead keep appending, and the pointer needs to grow with every append, it *could* reallocate with every append.
>
> --
> Steve Mills
> office: 952-818-3871
> home: 952-401-6255
> cell: 612-803-6157
>
>
>
> _______________________________________________
>
> 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
_______________________________________________
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