-
Bug
-
Resolution: Fixed
-
P3
-
1.0
-
1.0.2
-
sparc
-
solaris_2.5
-
Not verified
I was surprised to find that String.substring makes unnecessary copies,
even though the underlying character array is never modified,
and the string itself is designed to be immutable.
Also, with all the extra copying going on, the field String.offset
is now identically zero. This is probably also a performance bug,
even if the copying were somehow desirable.
Background: I was assuming that I could read a file into a big char[]
and then parse around in it, making constant-size String objects as I
went. I was surprised to find that String objects are non-constant in
size, even when created from an explicit body array.
even though the underlying character array is never modified,
and the string itself is designed to be immutable.
Also, with all the extra copying going on, the field String.offset
is now identically zero. This is probably also a performance bug,
even if the copying were somehow desirable.
Background: I was assuming that I could read a file into a big char[]
and then parse around in it, making constant-size String objects as I
went. I was surprised to find that String objects are non-constant in
size, even when created from an explicit body array.