I just realized that I also use String.trim() a lot, and have always
assumed it's very cheap; that's no longer the case.
JDK itself contains many usages of trim(); even a lot of
str.substring().trim()
Just saying.
On Wed, Nov 14, 2012 at 9:14 AM, Zhong Yu wrote:
> Changing String.substring
Hi,
This change is 6 months old now. I wonder if Oracle received any complaints
from the users since then. I mean complaints that are based on real
observations of performance degradation in real code - not only speculation.
Regards, Peter
2012/11/15 Zhong Yu
> Since this change is to achieve
Since this change is to achieve minor performance boost, it's not fair
to defend it by saying that it only incurs minor performance
penalties.
Java programs are infested with strings, most of which could have used
a more appropriate type, but it is the insane reality. Any change to
the behavior of
Personally, I feel like the concern is a bit overstated:
1) the n in O(n) is likely actually fairly small in practice (at least in
what I'd consider sane code)
2) I think a lot of people that worry about perf probably aren't using
substring() anyway
3) copying char[] is optimized by jit - this is
On 06/03/2012 11:35 PM, Mike Duigou wrote:
> [I trimmed the distribution list]
>
> On Jun 3 2012, at 13:44 , Peter Levart wrote:
>
>> On Thursday, May 31, 2012 03:22:35 AM mike.duigou at oracle.com wrote:
>>> Changeset: 2c773daa825d
>>> Author:mduigou
>>> Date: 2012-05-17 10:06 -0700
>>> U
On 14/11/2012 16:06, Remi Forax wrote:
Now, I don't know why this change was backported to a jdk update,
but it's more a question to the jdk7 update mailing list.
It was to offset the addition of the hash32 field.
-Alan.
Hi Zhong Yu,
I agree with you that changing the implementation of something
like String.substring which is widely used is something that is always a
little hairy.
The memory leak you mention is one side of the problem, the other is that
we want the VM to do memory collocation of String (i.e. al
The new implementation also introduces a new form of memory leak.
Previously N substrings take O(N) space. Now it takes O(N*m) space
where m is the average length of substrings.
Some applications may be double penalized by the new implementation -
both CPU and memory go up.
On Wed, Nov 14, 2012 a
Changing String.substring() from O(1) to O(n) is a big deal; we may
say it breaks compatibility.
Any code that intends to work across JDK versions before and after 7u6
cannot use the method, since its behavior is so different in different
versions.
Any deployment that upgrades JDK to 7u6 and late
For the record, javadoc uses substring very heavily, and might be
impacted by this change.
-- Jon
On 06/03/2012 02:35 PM, Mike Duigou wrote:
[I trimmed the distribution list]
On Jun 3 2012, at 13:44 , Peter Levart wrote:
On Thursday, May 31, 2012 03:22:35 AM mike.dui...@oracle.com wrote:
C
On Thursday, May 31, 2012 03:22:35 AM mike.dui...@oracle.com wrote:
> Changeset: 2c773daa825d
> Author:mduigou
> Date: 2012-05-17 10:06 -0700
> URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/2c773daa825d
>
> 6924259: Remove offset and count fields from java.lang.String
> Summary: R
In getBytes() you do not need:
int n = srcEnd;
int i = srcBegin;
You could already use srcEnd srcBegin
@@ -1015,16 +968,16 @@ public final class String
return true;
}
if (anObject instanceof String) {
-String anotherString = (String)anObject;
-
On 06/03/2012 11:35 PM, Mike Duigou wrote:
[I trimmed the distribution list]
On Jun 3 2012, at 13:44 , Peter Levart wrote:
On Thursday, May 31, 2012 03:22:35 AM mike.dui...@oracle.com wrote:
Changeset: 2c773daa825d
Author:mduigou
Date: 2012-05-17 10:06 -0700
URL: http://hg.open
[I trimmed the distribution list]
On Jun 3 2012, at 13:44 , Peter Levart wrote:
> On Thursday, May 31, 2012 03:22:35 AM mike.dui...@oracle.com wrote:
>> Changeset: 2c773daa825d
>> Author:mduigou
>> Date: 2012-05-17 10:06 -0700
>> URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/2c77
Changeset: 2c773daa825d
Author:mduigou
Date: 2012-05-17 10:06 -0700
URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/2c773daa825d
6924259: Remove offset and count fields from java.lang.String
Summary: Removes the use of shared character array buffers by String along with
the two fie
15 matches
Mail list logo