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

Andrew John Hughes gnu_andrew at member.fsf.org
Tue Jun 3 08:08:19 UTC 2008

2008/6/3 Andrew Haley <aph at redhat.com>:
> Ian Rogers wrote:
>> please give your comments on the attached patch. It tries to reduce the
>> size of char[] for strings used to hold numbers. It changes Float/Double
>> equals to use bit based comparisons rather than division. It increases
>> the use of valueOf methods. It adds a cache of values from -128 to 127
>> for Long. It adds a cache of the values of zero and one to Float and
>> Double.
>> The string size is an estimate. For decimal numbers it will divide the
>> value repeatedly by 8, causing the string length to be over estimated by
>> a character for values like 999. This string size is still better than
>> the current estimate of 33 characters. It also avoids the use of
>> division (shifts are used) and/or lookup tables.
> I am really not convinced by the cache of values from -128 to 127.  It's
> a significant overhead for the startup time, and I find it hard to imagine
> a justification for it.
> Andrew.

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.
Andrew :-)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA 7927 142C 2591 94EF D9D8

More information about the Classpath-patches mailing list