[cp-patches] RFC: changes to java.lang.Integer, Long...

Robert Schuster theBohemian at gmx.net
Tue Jun 3 09:12:44 UTC 2008


Hi,

Andrew John Hughes schrieb:
 > I'd second that.  Are there clear performance benefits to justify
> creating 256 objects ahead of time?
> Not only does that introduce an overhead in initialising the Long
> class, but it also results in increased
> memory usage for all applications.
> 
> I'd also prefer that future patches focused on just one change.  This
> seems to be in essence four
> patches in one.

Couldnt we have the best of both world? Instead of initializing the
array with all values explicitly let us do it lazily. Something like:

Integer valueOf(int i)
{
  Integer I = cached[i];
  if (I == null)
   I = cached[i] = new Integer(i);

  return I;
}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://developer.classpath.org/pipermail/classpath-patches/attachments/20080603/bcd9c5e1/attachment-0001.pgp 


More information about the Classpath-patches mailing list