Java Performance Tuning

Today I read an article written by Jesse Wilson long time ago, Jesse Wilson is a developer of Square, he is the author of project OkIO which opensourced by Square.

In this article, Jesse Wilson mentioned something sounds familiar to me:

Usually when Java developers do performance tuning, it seems the strategy is generally ad-hoc and untargetted. I am certainly guilty of using this approach, and the code I've written suffers as a consequence. My ad-hoc approach is lame: Write a main() method that exercises the code of interest
Sprinkle System.currentTimeMillis() calls throughout
Add extra code to warm-up HotSpot
Run the application, watching execution time getting printed to System.out
Cut and paste the execution time to a spreadsheet
Tweak the code of interest, randomly poking at things that look slow
Repeat the tests. If my change turns out to be slower, I check out the original implementation from CVS and redo the executions to confirm the data in the spreadsheet. Finally, I rollback the change.

Haha, what he said make me smile. That's exactly what I do when it comes to "Java Permance Tuning".

comments powered by Disqus