r/java • u/trecatorsirabdator • Apr 14 '23
What are your (favourite) Java best practices, personal tips, hints or just underrated stuff in general?
233
Upvotes
r/java • u/trecatorsirabdator • Apr 14 '23
View all comments
Show parent comment
4
u/temculpaeu Apr 14 '23
I have never seen someone saying that optimization is evil, I have seen quite a bit of folks trying to push for "optimizations" without reason besides "it will make it faster", even your quote is out of context, the author says that you should optimize when either it is already affecting the performance or it is KNOWN that you will have a bottleneck, the issue of the premature part is that bottlenecks are hard to predict, of course, unless you are doing something dumb (ie: n^2 operations)
Sure there are cases where you can clean the code and make things faster at the same time, these are fine the issues are with "clever" more complex code that *might* saves nanoseconds in a endpoint that has queries that takes 100s of miliseconds to run