No engine interns computed strings unconditionally. Consider concatenated 
strings, the silly benchmarks that s += s for s = "x" up to 20 or more times.

Engines do optimize string comparison to compare pointers first, in case both 
comparands are interned. Engines also know when a string is interned so they 
can optimize accordingly. Engines also intern small int literal strings, e.g.

/be

On Oct 3, 2011, at 6:28 PM, Allen Wirfs-Brock wrote:

> 
> On Oct 3, 2011, at 10:17 AM, David Herman wrote:
> 
>> A couple reactions:
>> 
>> - strings are already interned in current engines for symbol-like 
>> performance; there's no need to introduce symbols into the language
> 
> Is this really true?  It was my original assumption based upon string 
> semantics. However, I was latter lead to believe that many engines don't 
> routinely intern/canonicalize strings and hence string equality comparisons 
> can't be assume to have the performance of  pointer comparisons.  For 
> example, it was my understanding that SpiderMonkey uses interned strings for 
> property lookup but that it doesn't necessarily intern non-property key 
> strings??
> 
> 
> Allen
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to