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


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

Re: java8 up to 6x slower than java7

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: java8 up to 6x slower than java7
Date 2014-02-16 13:10 +0100
Message-ID <bmbo69F4b27U1@mid.individual.net> (permalink)
References <29a51a94-8f9a-41b1-980f-e8c13e2d11a2@googlegroups.com> <ldnitt$mtv$1@news.albasani.net> <ldnkf1$pp0$1@news.albasani.net>

Show all headers | View raw


On 15.02.2014 12:52, Jan Burse wrote:

> I must admit that I don't use the Java hashmap and have written
> a custom version. The reason for this custom version was basically
> to allow faster iteration, and not allocating an iterator. This
> was already done before JDK 8 came out, independent of JDK 8.

I also once wrote a Map using double Hashing.  The reason at the time 
was to avoid the many Entry instances.  But we did only replace certain 
uses of HashMap which we knew would create and GC lots of Entry 
instances and have rare iterations (Entry instances were created during 
iteration only, this was the downside).

> But I now read that JDK 8 has introduced a new realization
> of HashMap. See for example:
>
> http://blog.credera.com/technology-insights/java/java-8-part-3-hashmap-java-time/

How is this supposed to work for keys which do not implement Comparable? 
  Or are they using the hash code only for the tree arrangement?  Also, 
the article does not mention that the fill factor limits the average 
length of the chain used for linear probing.

It's also not mentioned in the article how they create the tree.  You 
can use an object per node but you can sometimes also use an array.

> So I understand that you could see dramatic negative changes.
> Sorry to hear that.

I am surprised that they do such a dramatic change to a standard library 
class.  In the past Sun / Oracle seemed to always try to minimize the 
impact on programs.

> I will check my code more closely now, and try to eliminate more
> of HashMap by my custom code where appropriate.

I would first do some analysis before going there to determine how long 
linear probing is on average.

Kind regards

	robert

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


Thread

java8 up to 6x slower than java7 Dennis Haupt <d.haupt82@gmail.com> - 2014-02-15 03:00 -0800
  Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-15 12:26 +0100
    Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-15 12:28 +0100
    Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-15 12:52 +0100
      Re: java8 up to 6x slower than java7 Robert Klemme <shortcutter@googlemail.com> - 2014-02-16 13:10 +0100
        Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-16 14:38 +0100
          Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-16 14:43 +0100
            Re: java8 up to 6x slower than java7 Robert Klemme <shortcutter@googlemail.com> - 2014-02-16 14:53 +0100
              Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-16 20:27 +0100
                Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-02-16 20:36 +0100
                Re: java8 up to 6x slower than java7 Robert Klemme <shortcutter@googlemail.com> - 2014-02-17 18:55 +0100
                Re: java8 up to 6x slower than java7 Wanja Gayk <brixomatic@yahoo.com> - 2014-03-02 20:52 +0100
                Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-03-03 11:53 +0100
                Re: java8 up to 6x slower than java7 Joerg Meier <joergmmeier@arcor.de> - 2014-03-03 17:16 +0100
                Re: java8 up to 6x slower than java7 Jan Burse <janburse@fastmail.fm> - 2014-03-03 19:53 +0100
                Re: java8 up to 6x slower than java7 Lew <lewbloch@gmail.com> - 2014-03-03 13:44 -0800
      Re: java8 up to 6x slower than java7 Kevin McMurtrie <mcmurtrie@pixelmemory.us> - 2014-02-16 11:24 -0800
  Re: java8 up to 6x slower than java7 Robert Klemme <shortcutter@googlemail.com> - 2014-02-15 12:55 +0100
  Re: java8 up to 6x slower than java7 "Qu0ll" <Qu0llSixFour@gmail.com> - 2014-02-15 23:42 +1100
  Re: java8 up to 6x slower than java7 Roedy Green <see_website@mindprod.com.invalid> - 2014-02-16 00:25 -0800

csiph-web