views:

212

answers:

7

What are Best books on how to optimize and profile Java code?

+4  A: 

It's not a book, but www.javaperformancetuning.com offer a monthly newsletter. The website itself has a wealth of information on tuning and performance, including a list of recommended books.

Brian Agnew
Thank you Brian
Nadir SOUALEM
+3  A: 

I'd suggest Java Performance Tuning by Jack Shirazi. The www.javaperformancetuning.com site he started after he wrote the book is very interesting too. Kirk Pepperdine is a major contributor to this site and is a well known performance guru. His blog is another good reading.

PS: There is a Books section on the www.javaperformancetuning.com site that you might want to check.

Pascal Thivent
A: 

I'd also recommend reading up on JVM in order to gain some insight on Java internals.

Marius Burz
A: 

Though the books are a bit dated, I've learned the most about profiling and tuning from chapter 15 of J2EE Design and Development and chapter 15 of J2EE Development without EJB, both by Rod Johnson. Johnson's philosophy is to take and evidence-based approach to profiling and tuning, meaning gather statistics then optimize the parts of your code that will really make a difference.

I would also just recommend downloading a trial version of a profiler and learning how to use it. The best ones I've used are JProfiler and YourKit, You can find plenty of others out there as well though.

Jason Gritman
A: 

Start reading this article http://www.yourkit.com/docs/80/help/performance_problems.jsp

Serge
A: 

Are you by any chance trying to learn how to do performance tuning? Then don't overlook this.

Mike Dunlavey
A: 

Netbeans has a free profiler built in.

Why not just run start it up and profile some of your code?

The problem with profiling Java is that it can be non-intuitive. Hotspot in Server mode can and will optimize your code in ways that you would not think of and shouldn't.

Unless you have a really really good reason to profile - read a book on better design first and worry about profiling much much later. I rarely break out the profiler - the last time was two years ago when we had a strange memory leak. Netbeans helped us find it pretty quickly.

Fortyrunner