Re: string literals and performance

2014-05-25 Thread Jens Alfke
On May 25, 2014, at 3:18 AM, 2551 <2551p...@gmail.com> wrote: > That's what I understood from the stackexchange discussion I linked to. As I > said, those issues aren't relevant in this case, so I was wondering if there > were others. From the replies thus far, it seems not, and I'm inclined to

Re: string literals and performance

2014-05-25 Thread 2551
> On 25 May 2014, at 15:11, Gary L. Wade wrote: > The performance benefit for choosing the first style over the second style > comes in if you need to debug your app or change the contents of a string > literal. That's what I understood from the stackexchange discussion I linked to. As I said,

Re: string literals and performance

2014-05-25 Thread Gary L. Wade
The performance benefit for choosing the first style over the second style comes in if you need to debug your app or change the contents of a string literal. If you hard code the same string everywhere you use it, as with the second case, you are either going to copy/paste or type it all over a

Re: string literals and performance

2014-05-24 Thread Quincey Morris
On May 24, 2014, at 21:08 , 2551 <2551p...@gmail.com> wrote: > Are there any performance implications that would suggest preferring one or > the other of these different styles? > > NSString *s = @"sing me a song"; > [myClass aMethod: s]; > > and > > [myClass aMethod: @"sing me a song”]; Basi

Re: string literals and performance

2014-05-24 Thread Stephen J. Butler
You misunderstand the point of the Stackoverflow answer. In the first example you've given it looks like "s" is just a stack local variable. In that case there is no difference between the two examples. Actually, in the face of optimization I bet the assembly turns out exactly the same. Use the lat

string literals and performance

2014-05-24 Thread 2551
Are there any performance implications that would suggest preferring one or the other of these different styles? NSString *s = @"sing me a song"; [myClass aMethod: s]; and [myClass aMethod: @"sing me a song"]; I have a lot of the first kind in my code, and I'm thinking of simplifying it by tu