|
From: | Ivan Vučica |
Subject: | Re: Problem with NSString |
Date: | Sun, 30 Jan 2011 22:35:52 +0100 |
Am 30.01.2011 um 18:16 schrieb David Chisnall:On 30 Jan 2011, at 16:51, Ivan Vučica wrote:while(![@"Quit" isEqualToString:word2]) or while(![word2 isEqualToString:@"Quit"])Straying wildly off-topic, but the first form is preferable from the compiler's point of view. It means that the class of the receiver is known at compile time, which means that we can have a better stab at speculative inlining.
That is awesome? Perhaps optimization pass could take a look if NSString subclasses exist and optimize if that is not the case as well?
And not only that. It is also a good practice of defensive coding, e.g. you don't run into problems if word2 happens to be Nil.
But, sending message to nil is safe and returns zero :-)
This is currently only done in an experimental optimisation pass on my machine, but it will probably become one of the standard Objective-C passes used by clang for the GNUstep runtime sometime this year.Great! I am looking forward to this.
Ditto!
[Prev in Thread] | Current Thread | [Next in Thread] |