Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-23 Thread Zhong Yu
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-15 Thread Peter Levart
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Zhong Yu
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Vitaly Davidovich
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Zhong Yu
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Alan Bateman
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.

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Remi Forax
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Zhong Yu
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-11-14 Thread Zhong Yu
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-06-14 Thread Jonathan Gibbons
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-06-11 Thread Peter Levart
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-06-04 Thread Ulf Zibis
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; -

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-06-04 Thread Rémi Forax
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

Re: hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-06-03 Thread Mike Duigou
[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

hg: jdk8/tl/jdk: 6924259: Remove offset and count fields from java.lang.String

2012-05-30 Thread mike . duigou
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