[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: String.equals optimisation

From: Stephen Crawley
Subject: Re: String.equals optimisation
Date: Tue, 12 Jul 2005 15:46:03 +1000

address@hidden said:
> I'd be interested to hear of other reasons for Java's requirement to
> intern all literal strings and constants. 

Backwards compatibility.

At this point we can only conjecture as to why Java was originally defined 
this way.  My guess is that this decision was made in the early days when
the language was being targeted at embedded computing and machines with
not a lot of memory.  Having the JVM do interning of literals could save
enough memory to matter.

The world has moved on, and nobody thinks much about conserving string 
space these days.  But there are enough programs out there that rely on
this historical quirk that it is too hard to change ... even if it was
thought to be a worthwhile thing to do.

-- Steve

reply via email to

[Prev in Thread] Current Thread [Next in Thread]