Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27673
| From | Jan Burse <janburse@fastmail.fm> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: java8 up to 6x slower than java7 |
| Date | 2014-03-03 19:53 +0100 |
| Organization | albasani.net |
| Message-ID | <lf2j36$cu4$1@news.albasani.net> (permalink) |
| References | (8 earlier) <ldr3vk$n4h$1@news.albasani.net> <bmf0noFpsoqU1@mid.individual.net> <MPG.2d7daa55f1e6c2a8b@202.177.16.121> <lf1mvk$iho$1@news.albasani.net> <lke298guvu4z.12emsy2hy4q19$.dlg@40tude.net> |
Hi,
It seems to me that the ConcurrentHashMap of JDK 8
adopts the tree structure for lage bins already
found in the HashMap of JDK 8. Namely I find:
ConcurrentHashMap JDK 5:
No method treeifyBin in source code found.
(Related to this thread, i.e. is JDK 8 slower?)
No method computeIfAbsent in source code found.
(Not directly related, but also interesting)
ConcurrentHashMap JDK 8:
A method treeifyBin in source code found.
(Related to this thread, i.e. is JDK 8 slower?)
A method computeIfAbsent in source code found.
(Not directly related, but also interesting,
see also:
http://stackoverflow.com/questions/19278443/how-do-i-use-the-new-computeifabsent-function)
Since ConcurrentHashMap uses more effectively inner
locks, I will destroy all this efficiency when I
use an outer lock.
This is my concern when I would use the concurrent
hash map as follows:
synchronized(map) {
/* do more than one operation on map,
atomically */
}
This concern also holds if I use as an extra lock
for example:
public final lock = new Object();
synchronized(lock) {
/* do more than one operation on map,
atomically */
}
The only benefit respectively drawback of the
extra lock is that more memory is used.
But nevertheless the pattern of an extra lock
is often seen for various reasons.
Bye
Joerg Meier schrieb:
> On Mon, 03 Mar 2014 11:53:41 +0100, Jan Burse wrote:
>
>> Me myself is anyway a hopeless case. I just discovered
>> ConcurrentHashMap in JDK 8. Very interesting, it doesn't
>> use a lock on the outside, but I counted 9 times a
>> synchronized statement inside the code.
>
> From
> <http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html>
>
> Since:
> 1.5
>
> Not exactly new ;)
>
> As for your problem, I didn't quite understand your problem description,
> but just in case you aren't aware, you don't have to synchronize on the
> object you deal with in the block - you can synchronize on anything you
> want, and many people use a helper field like
>
> private final Object $LOCK = new Object();
>
> Liebe Gruesse,
> Joerg
>
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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