I am wondering if interning Strings will be really that critical for performance. The biggest bottle neck is still disk. So, maybe we can use String.equals(...) instead of ==.
Jian On 5/1/06, DM Smith <[EMAIL PROTECTED]> wrote:
karl wettin wrote: > The code is filled with string equality code using == rather than > equals(). I honestly don't think it saves a single clock tick as the > JIT takes care of it when the first line of code in the equals method > is if (this == that) return true; If the strings are intern() then it should be a touch faster. If the strings are not interned then I think it may be a premature optimization. IMHO, using intern to optimize space is a reasonable optimization, but using == to compare such strings is error prone as it is possible that the comparison is looking at strings that have not been interned. Unless it object identity is what is being tested or intern is an invariant, I think it is dangerous. It is easy to forget to intern or to propagate the pattern via cut and paste to an inappropriate context. > > Please correct me if I'm wrong. > > I can commit to do the changes to the core code if it is considered > interesting. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]