What native HashTable is used? Shouldn't the JVM be using an optimized one?
What native HashTable is used? Shouldn't the JVM be using an optimized one?
Edit: pardon the dupes, on unreliable mobile link :-(
The issue with Hashtable or rather all legacy collection classes is that the API is rarely useful without additional synchronization. So you might as well use a HashMap wrapped by Collections.synchronizedMap or use a ConcurrentHashMap with a placeholder object instead of null.
https://github.com/JetBrains/jdk8u_hotspot/blob/master/src/s...
Interestingly, the hash table implementation it's subclassing has changed from `HashTable` to `RehashableHashtable` between JDK7 and JDK8, so I guess there's at least been work to try and improve the performance there.
The hashmap header is here, code lives in the matching cpp file in the same directory:
https://github.com/JetBrains/jdk8u_hotspot/blob/master/src/s...