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

Peter Levart peter.levart at gmail.com
Sun Jun 3 20:44:38 UTC 2012

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
> 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 fields needed to support the use of shared buffers.

Wow, that's quite a change.

So .substring() is not O(1) any more?

Doesn't this have impact on the performance of parsers and such that rely on 
the performance caracteristics of the .substring() ?

Have you considered then implementing .subSequence() not in terms of just 
delegating to .substring() but returning a special CharSequence view over the 
chars of the sub-sequence?

Regards, Peter

> Reviewed-by: alanb, mduigou, forax, briangoetz
> Contributed-by: brian.doherty at oracle.com
> ! src/share/classes/java/lang/Integer.java
> ! src/share/classes/java/lang/Long.java
> ! src/share/classes/java/lang/String.java
> ! src/share/classes/java/lang/StringCoding.java

More information about the core-libs-dev mailing list