Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

force inline in java [duplicate]

I looked at this post. It looks nice. However the authors or other aware people will tell me tricks with coding when HotSpot (does not depend on server or client or not Sun version) makes a code inline.

like image 929
itun Avatar asked Oct 12 '11 17:10

itun


1 Answers

Don't waste your time on unreasonable optimization. Write you code simple, to make it easy to maintain, and let the JIT take care of optimization.

javac almost never inline anything (which is good). JVM does it often (which is very good). Algorithms to determine when and how to do what optimization by JIT is a rocket science. Don't try to make your code smarter than that.

If you trying to gain performance, then use profiler. If you trying to make your code harder to reverseengineer, use tools like proguard.

like image 63
Michał Šrajer Avatar answered Sep 22 '22 04:09

Michał Šrajer