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.