Wrote about performance improvments in the OpenJDK again: https://inside.java/2025/10/20/jdk-25-performance-improvements/
Performance Improvements in JDK 25 – Inside.java

Java is constantly evolving with ever increasing performance. JDK 25 comes with significant performance improvements compared to previous versions including scoped values, improved GCs, lots of compiler improvements, and much more.

@cl4es constant foldable String.hash is a great addition to such heavily used call site.

#java #openjdk 

@mbien sure, it can allow some pretty remarkable speed-ups to code that might be on the hot path. Constant folding unintentionally became a little bit of a theme in this article.
@cl4es is hash() of an Enum also stable for the JVM? EnumSet.conains() is still faster than Set.of(enums).contains(). Set.of() should be able to outperform EnumSet at some point if the trend continues since it has the advantage of being immutable, right?
@mbien yes, this was actually fixed in JDK 21, with good improvements in microbenchmarks: https://github.com/openjdk/jdk/pull/13491#issuecomment-1511630835
8306075: Micro-optimize Enum.hashCode by olivergillespie · Pull Request #13491 · openjdk/jdk

Improve the speed of Enum.hashCode by caching the identity hashcode on first use. I've seen an application where Enum.hashCode is a hot path, and this is fairly simple speedup. The memory overh...

GitHub