https://hg.openjdk.java.net/jdk/jdk14/file/f77e9e27b68d/src/...
There's no hard data to show that a smaller value would give better performance for typical Java workloads. Resizing operations are quite expensive.
https://hg.openjdk.java.net/jdk/jdk14/file/f77e9e27b68d/src/...
There's no hard data to show that a smaller value would give better performance for typical Java workloads. Resizing operations are quite expensive.
See this comment, and also the implementation of putVal()/resize(): https://hg.openjdk.java.net/jdk/jdk14/file/f77e9e27b68d/src/...
Perhaps things were different back in Java 1.3.
EDIT: Apologies, I completely missed this in the article, where it's explicitly called out.
This particular trick also no longer works. As I found out while writing this article, modern JDKs do not allocate any space in a HashSet until something is added. If I had kept applying this trick pre-emptively I would have been wasting my time.