Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Performance books put to the test - JavaWorld March 2001

Performance books put to the test - JavaWorld March 2001

Tutorial Details:

Performance books put to the test
Performance books put to the test
By: By John Zukowski
Tune up your Java programs with the help of these Java books
any people complain about the performance of their Java programs. Expecting miracles, or just giving in to hype, they want unoptimized programs to perform faster than natively C/C++-compiled code. I don't mean to say that everyone writes poorly written code, but unoptimized code is often less than perfect and can be tweaked to run faster while still being maintainable. In this article, I'll examine six Java books that explore ways to help you improve your Java programs' performance.
The six books are:
Java Platform Performance: Strategies and Tactics, Steve Wilson and Jeff Kesselman (Addison-Wesley, January 2000)
Java Performance Tuning, Jack Shirazi (O'Reilly & Associates, September 2000)
Enterprise Java Performance, Steven Halter and Steven Munroe (Prentice Hall/Sun Microsystems Press, August 2000)
Java Performance and Scalability, Volume 1: Server-Side Programming Techniques, Dov Bulka (Addison-Wesley, June 2000)
Java 2 Performance and Idiom Guide, Craig Larman and Rhett Guthrie (Prentice Hall, August 1999)
Practical Java Programming Language Guide, Peter Haggar (Addison-Wesley, February 2000)
Table 1 provides a quick look at the books' main characteristics. The first two rows should be self-explanatory. The remaining rows describe the books' coverage of improving performance in different Java technology areas.
Table 1: Performance books overview
Java
Platform Performance
Java
Performance Tuning
Enterprise
Java Performance
Java
Performance and Scalability
Java
2 Performance and Idiom Guide
Practical
Java
Price
$34.95
$34.95
$49.99
$34.95
$39.99
$32.95
Total Pages
230
430
410
290
300
280
CD-ROM/Source from Web
No / Yes
No / Yes
No / Yes
No / Yes
No / No
No / Yes
Tuning Overview
Good
Very Good
Good
Poor
Average
None
Coding Techniques
Average
Good
Poor
Average
Good
Very Good
Object Loading
Good
Average
None
Average
Average
Average
Data Structures
Good
Very Good
Poor
Average*
Average
Average
Threads
Poor*
Very Good
Poor
Good
Average*
Good
GUIs
Good
Poor
None
None
None
None
I/O
Average
Good
Poor
Average
Average
Average
Distributed Computing
None
Good
Very Good
Very Good
Poor
None
JNI
Good
None
None
Average
None
None
Scale: None, Poor, Average, Good, Very Good
A star (*) in a field means the review of the specific book provides further details of the ranking.
Now I'll review each book individually. The order in which I review them is random and not based on their rankings. Beside each book's title is a star rating that is based on the level of coverage and depth of techniques regarding Java performance tuning. One star is a poor rating; the highest rating (five stars) indicates exceptional coverage.
Java Platform Performance: Strategies and Tactics
At only 230 pages -- the smallest of the bunch -- Java Platform Performance tries to pack lots of tips into a small amount of space. It does an excellent job, if your needs match the topics covered. Most readers should have an interest in a majority of the topics.
The book is divided nicely into two parts: one has information on the strategies involved in increasing performance, the other explains the tactics necessary to implement those strategies. Two in-depth appendices describe garbage collection and HotSpot. The garbage-collection chapter focuses mostly on the object life cycle, including a nice description of reference objects; the HotSpot chapter compares optimization techniques that HotSpot uses and the techniques you can use in your code.
The Strategies section, which is three chapters long, explains what performance is and how to measure it. I found the third chapter, which describes benchmarking and profiling-analysis techniques for performance measurement, most useful.
The meat of the book is the Tactics section, which covers nine topics, though not all are intended to help the reader improve performance:
I/O Performance: Covers buffered I/O and serialization issues
RAM Footprint: Describes how to measure memory usage
Controlling Class Loading: Describes the nature of Java's dynamic class loading and techniques to improve it
Object Mutability: Strings and Other Things: Covers the typical String vs. StringBuffer argument with techniques to reduce the number of created objects
Algorithms and Data Structures: Selects the right collection class and algorithm
Using Native Code: Describes the pitfalls of JNI usage with some short case studies
Swing Models and Renderers: Discusses Swing's MVC architecture and how to best take advantage of it
Writing Responsive User Interfaces with Swing: Describes invokeLater() and invokeAndWait() usage, as well as the Timer class
Deployment: Covers deployment with JAR files
Overall, I found the techniques useful in the areas I was interested in: collections and Swing. The complete code examples are well done, as are the many tables comparing performance. You should incorporate several of the tactics into your everyday coding. And if you think JNI is the answer to your performance woes, this book helps explain why it isn't. The biggest problem that I found was the book's coverage of multithreading, which was limited to areas like Swing with invokeLater() and invokeAndWait() .
Java Performance Tuning
Java Performance Tuning -- the largest and newest book in the bunch -- is similar in style to Java Platform Performance, but boasts a much broader set of tactics and more in-depth explanations (in the form of real-world examples).
Java Performance Tuning offers optimization techniques on nearly everything a server-side developer would want to know -- with multiple reasons for not using many system classes. Jack Shirazi offers an enlightening tip on the performance (or lack thereof) of StreamTokenizer . I think my days of using it are over.
Nine of the book's fifteen chapters -- described in the following list -- cover the bulk of the optimization techniques. The remaining chapters help get you started with tools and describe tuning techniques beyond the code level, like things you can do with the underlying system. The final chapter is more of an appendix with a list of resources.
Object Creation: Shows how to reduce the number of objects created
Strings: Describes improvements in comparing and searching
Exceptions, Casts, and Variables: Covers access usage optimizations
Loops and Switches: Describes some general optimization coding techniques
I/O, Logging, and Console Output: Discusses replacing System.out , serialization optimizations, and compression (though it offers no code for compression)
Sorting: Uses hand-crafted sorting
Threading: Discusses how to better design and limit the number of locked resources
Appropriate Data Structures and Algorithms: Covers selecting the right collection class and algorithm; includes a nice hash map to match partial string keys
Distributed Computing: Describes ways to optimize message passing and data transfers
Each chapter ends with a "performance checklist" to help remind you to perform the code-tuning tasks discussed. The checklists can also help you refresh your knowledge weeks or months after you've read the book.
Experienced Java developers will like the techniques described in Java Performance Tuning and should be able to improve performance considerably by implementing them.
Enterprise Java Performance
Coming in from left field is Enterprise Java Performance. This book is so unlike the others that I'm not sure where to start describing it. Probably the simplest way to start is with the authors. Enterprise Java Performance is by Steven Halter and Steven Munroe -- two of the leaders of IBM's SanFrancisco project. SanFrancisco is a business component framework for Java that helps developers of large distributed business/e-commerce applications start from a prebuilt set of business objects. The emphasis is on large here. Halter and Munroe's experience with large systems plays out well in the book.
With that said, what is the book about?
The first two parts of Enterprise Java Performance help you to understand the needs of large-scale performance optimization: from the tools and coding techniques in Part 1 to the discussion of various performance issues in Part 2 (dubbed "Performance Physics"). There are about 160 pages on the optimization techniques the other books spend all their pages on, such as local vs. remote issues and locking bottlenecks. While I found nothing wrong with the content, Enterprise Java Performance didn't match the other books' depth in those areas; I was hoping to find more code improvements that tell you to do this or that. However, Enterprise Java Performance does have information about enterprise-level applications that the other books do not.
In Part 3, you'll meet BOB (business object benchmark), as well as several other benchmarks. BOB goes beyond the common Java benchmarks available today; it includes application-level benchmarking and measures performance at a higher level of application functionality. If you like BOB, you can modify it to measure your own applications' performance.
Part 4 introduces the book's core application environments: SanFrancisco, Enterprise JavaBeans, CORBA, and Jini. This sounds great, but Halter and Munroe spend most of the time describing each particular environment -- leaving only about a page for performance issues.
Parts 5 and 6 stand out as some of the most useful material in the book, bringing in bits from the first two parts. They basically help you review design decisions you must make when developing large-scale systems. Remember, though, the discussion is about large-scale design needs, so you won't get the answer to "Do I try to reduce the number of classes in order to load faster, and should I compress my JAR file or not?"
For the


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Performance books put to the test - JavaWorld March 2001

View Tutorial:
Performance books put to the test - JavaWorld March 2001

Related Tutorials:

Reloading Applets
Reloading Applets
 
I want my AOP!, Part 3
I want my AOP!, Part 3
 
Put Java in the fast lane
Put Java in the fast lane
 
XML glossary
XML glossary
 
Best tools for mobile application development
Best tools for mobile application development
 
J2ME devices: Real-world performance
J2ME devices: Real-world performance
 
Java Tip 132: The taming of the thread
Java Tip 132: The taming of the thread
 
Get the inside track on J2EE architect certification
Get the inside track on J2EE architect certification
 
Axis-orizing objects for SOAP
Axis-orizing objects for SOAP
 
Simply Singleton
Simply Singleton
 
Into the mist of serializaton myths
Into the mist of serializaton myths
 
welofunc performer
welofunc performer is a web load test tool to support quality assurance of J2EE web applications.
 
J2EE application performance optimization
J2EE application performance optimization How to extract maximum performance from your J2EE Web applications In this article, Rahul Kuchhal demonstrates how to identify and resolve bottlenecks in a J2EE application. This article covers all the step
 
Software Download Central compatible.
GNU getopt - Java port A while back I found myself in need of a Java command line option parser. Unsatisfied with free versions I was able to find on the net, I volunteered to port the GNU getopt family of functions from C to Java. The current release
 
Comparing The Performance of J2EE Servers
Performance ReportThe standardization of the application server, thanks to Sun\'s J2EE specifications, has spawned a wealth of implementations. There are offerings from big players such as Sun, IBM, BEA and Oracle as well as numerous offerings from low-co
 
Developing Simple Struts Tiles Application
Developing Simple Struts Tiles Application Developing Simple Struts Tiles Application Introduction In this section I will show you how to develop simple Struts Tiles Application. You will learn how to setup the Struts Tiles and create example
 
Using tiles-defs.xml in Tiles Application
Using tiles-defs.xml in Tiles Application Using tiles-defs.xml in Tiles Application In the last section we studied how to forward the request (call) to a jsp page which specifies which tiles layout definition should be used to apply to the
 
New Technical Articles: 64-bit Programming on Solaris 10 OS for x86 Platforms
Four technical articles describe the new Sun Studio 10 software's 64-bit programming features on the Solaris 10 OS for x86 and AMD64 platforms. Important issues regarding the AMD64 ABI (Application Binary Interface), debugging, migration to 64-bits, and p
 
Updated Hardware Certification Test Suite Available for Download
Version 2.4 of the HCTS is now available. Use it to certify your hardware on the Solaris 9 Operating System (and updates) and the Solaris 10 OS, 32-bit and 64-bit environments.
 
Solaris 10 OS Certification Beta Exams
If you are an expert in system and network administration, you can get involved in the creation of three new Solaris 10 certification exams. These Beta exams count toward official Solaris Certification and allow you to provide comments and technical feedb
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.