• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

21. Java > Compilers

Compilers

Always use the latest version of any Java compiler, because compilers tend to generate better code in succeeding generations.

Compilers can help performance in the following ways:

Loop invariant code motion

Things that do not change within a loop should be moved outside of it. This is known as “loop invariant code motion” because you’re moving the invariants outside of the loop rather than recalculating them on every iteration.

Common subexpression elimination

Something like loop invariant code motion. You just do intense calculations once and store the result in a local variable. You may have more total bytecodes, but fewer intense calculations.

Strength reduction


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint