Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #21970

Re: String.substring in JDK 1.7.0_6+

From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: String.substring in JDK 1.7.0_6+
Date 2013-02-01 20:34 +0100
Organization albasani.net
Message-ID <keh5bl$kq8$1@news.albasani.net> (permalink)
References <510c0a6a$0$8985$ba4acef3@reader.news.orange.fr>

Show all headers | View raw


There seems to be more going on with Strings:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6962931

But I didn't find the original change request (CR)
or request for enhancement concerning the copy
semantics. There was some estimate on applications
impact and allotment for redesigning applications.

I didn't know about hash32 thing in the link below.
Your micro benchmark doesn't test hashCode, does it?

jlp schrieb:
> The String class was modified in JDK 1.7.0_6.
> String.substring that was 0(1)  before JDK 1.7.0_6, now becomes O(n)
>
> All is well explained at :
> http://java-performance.info/changes-to-string-java-1-7-0_06/
>
> I wrote a small test:
> https://gist.github.com/4692960
>
> java -Xms128M -Xmx128M teststring.Main 100000 1000000
>
> On my desktop:
> jdk 1.7.0_11 => 33 seconds / 252 KBytes Memory
> jdk 1.6.0_38 => 25 milliseconds / 782 KBytes Memory
> more than 1000 times faster ! ( Ok! for this stupid test ;-) )
>
> I don't think it is a good improvement ! Uses less memory, but you
> retrieve it, when the object is garbaged
> What do you think about this ?
>

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

String.substring in JDK 1.7.0_6+ jlp <jlp@jlp.com> - 2013-02-01 19:33 +0100
  Re: String.substring in JDK 1.7.0_6+ markspace <markspace@nospam.nospam> - 2013-02-01 10:38 -0800
    Re: String.substring in JDK 1.7.0_6+ jlp <jlp@jlp.com> - 2013-02-01 19:42 +0100
      Re: String.substring in JDK 1.7.0_6+ markspace <markspace@nospam.nospam> - 2013-02-01 10:45 -0800
        Re: String.substring in JDK 1.7.0_6+ jlp <jlp@jlp.com> - 2013-02-01 19:57 +0100
          Re: String.substring in JDK 1.7.0_6+ markspace <markspace@nospam.nospam> - 2013-02-01 11:20 -0800
  Re: String.substring in JDK 1.7.0_6+ Jan Burse <janburse@fastmail.fm> - 2013-02-01 20:34 +0100
  Re: String.substring in JDK 1.7.0_6+ Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-02-01 20:58 -0800
    Re: String.substring in JDK 1.7.0_6+ markspace <markspace@nospam.nospam> - 2013-02-01 22:55 -0800
      Re: String.substring in JDK 1.7.0_6+ Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-02-02 08:43 -0800
        Re: String.substring in JDK 1.7.0_6+ markspace <markspace@nospam.nospam> - 2013-02-02 10:56 -0800
          Re: String.substring in JDK 1.7.0_6+ Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2013-02-02 14:46 -0800
            Re: String.substring in JDK 1.7.0_6+ markspace <markspace@nospam.nospam> - 2013-02-02 15:31 -0800
            Re: String.substring in JDK 1.7.0_6+ Robert Klemme <shortcutter@googlemail.com> - 2013-02-03 15:09 +0100

csiph-web