classpath
[Top][All Lists]
Advanced

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

Re: String.equals optimisation


From: Simon Kitching
Subject: Re: String.equals optimisation
Date: Tue, 12 Jul 2005 11:46:17 +1200

On Tue, 2005-07-12 at 11:02 +1200, Simon Kitching wrote:
> It would certainly be nice to know that collection methods will
> automatically work more efficiently when the objects being manipulated
> are String objects that have been interned (of course String.intern has
> to be used appropriately).

Umm..sorry, this particular argument doesn't work. The proposed
optimisation only improves the speed of comparing an object to itself -
not the most common operation in collection work. Operations that speed
up determining when two objects are NOT equal would help much more. [1]

I still think the original patch is relevant though (just not this
point).

[1] eg org.apache.commons.collections.map.IdentityMap, but this relies
on unique objects for keys rather than just trying to optimise for them.

Regards,

Simon






reply via email to

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