Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Great ways to improve java performance


Published on

  • Be the first to comment

  • Be the first to like this

Great ways to improve java performance

  1. 1.<br />1<br />
  2. 2. Why performance is so important?<br />Java<br />2<br /><br />
  3. 3. Imagine a world where everything is UNLIMITED<br />3<br /><br />
  4. 4. Sorry!!You are in a world where everything is LIMITED<br />4<br /><br />
  5. 5. Why performance matters?<br />90% of requirements are complex<br />50% of apps share the same server<br />10% increase in end users every day<br />Performance should be planned initially and not inspected later.<br />5<br /><br />
  6. 6. Great ways to improveJava Performance<br />By B. Sai Prasad<br />6<br /><br />Simple<br />
  7. 7. Introduction<br />Java Puzzles<br />Short program<br />Where is the issue?<br />How to fix?<br />What did you learn?<br />7<br /><br />
  8. 8. Puzzle #1<br />8<br /><br />
  9. 9. Moral #1new operator creates a new object<br />“new operator can be avoided by re-using byte arrays, or re-using objects”<br />9<br /><br />
  10. 10. Puzzle #2<br />10<br /><br />
  11. 11. Moral #2Creating a Double from a string takes about 15 times than from a number<br />“Use primitive data types for constructors rather than String objects.”<br />11<br /><br />
  12. 12. Puzzle #3<br />12<br /><br />
  13. 13. Moral #3length() call in a tight loop can hit performance<br />“String length is pre-computed, stored in a local variable and used it in a tight loop”<br />13<br /><br />
  14. 14. Puzzle #4<br />14<br /><br />
  15. 15. Moral #4Default constructor is added automatically by compiler.<br />“Generated constructor invokes the super class constructor.”<br />15<br /><br />
  16. 16. Puzzle #5<br />16<br /><br />
  17. 17. Moral #5Minimize method calls by method inlining<br />“Inlining is done by expanding the inlined method’s code in the code that calls the method”<br />17<br /><br />
  18. 18. Puzzle #6<br />18<br /><br />
  19. 19. Moral #6System.arraycopy()efficiently copies one array to another<br />“For very short arrays, use of this method may be counterproductive, because of overhead in actually calling the method”<br />19<br /><br />
  20. 20. Puzzle #7<br />20<br /><br />
  21. 21. Moral #7BufferedReader reads characters in chunks<br />“the read() method found in BufferedReader simply returns characters from a buffer”<br />21<br /><br />
  22. 22. Puzzle #8<br />22<br /><br />
  23. 23. Moral #8Reuse. Reuse. Reuse.<br />“It is better to reuse the java libraries than creating something new”<br />23<br /><br />
  24. 24. Video<br /><br />24<br />