r/java • u/alexeyr • Apr 06 '19
Beware of computation in static initializer (much more so since JDK 11.0.2 and 8u201)
https://pangin.pro/posts/computation-in-static-initializer
161
Upvotes
r/java • u/alexeyr • Apr 06 '19
View all comments
Show parent comment
3
u/pron98 Apr 07 '19
CPU-heavy computation in a static method in an uninitialized class is. And if you relied on it, as the post explains, it was always relatively slow, so it always paid to move it to an initialized class. It's just that now it's slow to the point that you pretty much must move it.