• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fastest way to replace characters in string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fastest way to replace characters in string


  • Subject: Re: Fastest way to replace characters in string
  • From: Keary Suska <email@hidden>
  • Date: Thu, 22 Aug 2013 12:16:23 -0600

On Aug 22, 2013, at 12:05 PM, Thomas Wetmore wrote:

> Steve,
>
> Sorry, again I was unclear. Here is what I am trying to say:
>
> 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.
>
> I assume the capacity argument is used at that first allocation.
>
> Pre-allocation and the capacity argument are wholly orthogonal concepts.


I googled around and found a post at StackOverflow (http://stackoverflow.com/questions/8636983/what-is-the-best-way-to-initialize-nsmutablestring-object) that links to the open-source implementation of CFString. From there you can see what the optimization technique is, although I didn't notice *when* it allocates.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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


References: 
 >Fastest way to replace characters in string (From: Diederik Meijer | Ten Horses <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Wim Lewis <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Diederik Meijer | Ten Horses <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Jens Alfke <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Keary Suska <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Thomas Wetmore <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Steve Mills <email@hidden>)
 >Re: Fastest way to replace characters in string (From: Thomas Wetmore <email@hidden>)

  • Prev by Date: Re: Fastest way to replace characters in string
  • Next by Date: Re: Lack of IBAction in Some Classes
  • Previous by thread: Re: Fastest way to replace characters in string
  • Next by thread: Re: Fastest way to replace characters in string
  • Index(es):
    • Date
    • Thread