"This article focuses on some of the issues you'll face once you've learned the basic operational facts of JUnit and start writing real tests. It also introduces a few extensions to JUnit that will make your life a lot easier."
The authors of this article show the steps they took in optimising a java program to solve a puzzle. Initially, it took around 60,422,400 seconds (2 years!) to solve the puzzle. After some algorithm tuning, solution time came down to 157 seconds. When caching was used to minimise the impact of the garbage collector, execution time came down to 25 seconds. The authors estimate that further low-level java optimisations would shave another 10% off the total execution time. The conclusion they arrive at is that performance tuning should primarily focus on algorithm improvements, then technical performance improvements (object caches etc), and only once both of those areas have been exhausted consider low-level programming optimisations.