Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Tool For Code Optimization  RSS feed

 
John Vergis
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
could ne1 let me know wheteher there are any good tools available for java code optimization. I am currently on a task wherein i am supposed to optimize the code [Core java, JSP, Servlets] for performance issues.
Thanks
John
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have the best tool already: your own brain.
Get a good book on performance tuning and read that. O'Reilly has one specifically for Java.
 
Jessica Sant
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used JProbe a few times quite successfully -- basically it spits out what methods are taking the longest to run or which gets called the most... that way you can know what methods to concentrate on when you go into your code and try to optimize it.
Two operations that are REALLY expensive: String concatenation and object creation.
I'm moving this to the Performance forum where this topic is better suited.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Jamon toolkit http://www.jamonapi.com/ may help you decide what is taking too long.
The http://www.javaperformancetuning.com/ site is full of goodies.
There are several books and lots of sites addressing "Java performance tuning" - try a Google search.
Bill
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using JAMon in a web app with the JAMonFilter servlet filter allows you to keep stats on all file resources within your application with NO programming on your end. It will track performance stats on all file resources such as JSPs, servlets, gifs, jpgs, html, css.
The servlet filter is part of a demo war that can be downloaded from http://www.fdsapi.com. To see the servlet filter in action go to live demo at this site. You can download this war and install it on your app server too.
Here is the main code in the servlet filter. It doesn't get much easier than the servlet filtering for monitoring web apps.

To see all the filter code go to http://www.ssouza.com/fdsapi/JAMonFilter.java. Note the filter monitors accesses to this file too .
[Fixed the width of the code example - Ilja]
[ May 11, 2004: Message edited by: Ilja Preuss ]
 
John Vergis
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all 4 ur response.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!