@"" is a literal string and will exist at runtime. [NSString string] is probably a dynamically allocated object (but can be optimized so that it does not exist), and it could (in theory) be collected at runtime when it was no longer referenced. Both literal and dynamically distributed strings use sharing internally, so two @"" or two [NSString string] are likely to return the same object, even if not in the same file, but there is no guarantee that they will be. However, they cannot return the same object to each other.
In general, it does not matter, you should not rely on the equality of the pointer to check for equality of strings.
Looking at the assembly code, I would suggest that @"" has a performance advantage, but thinking that this is important, this is actually a case of premature optimization.
Just use @"" , it makes sense to be short and clear.
source share