This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Improve performance by using jdk 1.5 and 1.6  RSS feed

 
Rupesh Chavan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am working on existing java application which is on jdk 1.4.2,
I want to migrate this application to java 1.5/1.6 along with performance improvements
I used StringBuilder instead of StringBuffer,
Please suggest me any other code level performance benefits provided by 1.5/1.6
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15860
80
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

Micro-optimizations in the code (what is what you are asking for) rarely make any difference. If your software has a performance problem, the right thing to do is to first gather information about the cause of the problem - for example, use a profiler and other tools to find out where the bottleneck is in the application. Then find ways to reduce the bottleneck.

Blindly doing micro-optimizations in the hope to solve a performance problem is like trying to shoot a mosquito with a shot gun: most likely the mosquito will fly between the bullets and you will accomplish nothing.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your code multi-threaded? If so, be careful when changing StringBuffer to StringBuilder - it's not synchronized.

Also, you'll want to read up on the java.util.concurrent package - it contains many classes that can be used to speed up multi-threaded code.
 
Rupesh Chavan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jesper Young, Thank you for a valuable suggestion.
Ulf Dittmer,my application is not multithreaded.
 
Kees Jan Koster
JavaMonitor Support
Rancher
Posts: 251
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Rupesh,

There is another angle to this: Java 1.5+ gives you great insight in what your JVM is doing through JMX. This allows you to hook up jconsole and see the garbage collectors and memory pools in action. This in turn allows you to tune memory use in your application and actually see if memory optimisations had any effect.

PS. Skip 1.5 and go straight to 1.6. There is no reason to use 1.5 now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!