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: Jens Alfke <email@hidden>
- Date: Thu, 22 Aug 2013 16:41:21 -0700
On Aug 22, 2013, at 11:05 AM, Thomas Wetmore <email@hidden> wrote:
> Pre-allocation means to allocate space before you need it, which would be at init time.
> But there is no need to pre-allocate -- the first allocation can be postponed until the first item is put in the container or characters in the string.
This is nit-picking (and btw, that optimization doesn’t sound very useful to me.)
The point is that using -initWithCapacity: is a good optimization because it reduces, and hopefully eliminates, re-allocation of the backing store.
—Jens
_______________________________________________
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