Performance ConcurrentHashmap vs HashMap

Viewed 66458

How is the performance of ConcurrentHashMap compared to HashMap, especially .get() operation (I'm especially interested for the case of only few items, in the range between maybe 0-5000)?

Is there any reason not to use ConcurrentHashMap instead of HashMap?

(I know that null values aren't allowed)

Update

just to clarify, obviously the performance in case of actual concurrent access will suffer, but how compares the performance in case of no concurrent access?

8 Answers

Of course a Map without any lock system wins against one with thread-safe behavior which needs more work. The point of the Concurrent one is to be thread safe without using synchronized so to be faster than HashTable. Same graphics would would be very interesting for ConcurrentHashMap vs Hashtable (which is synchronized).

Related