Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
optimized stand alone program

 
Post new topic   Reply to topic    dna88 Forum Index -> Programming in Java, C, C#, VB, .NET Discussion Forum
Author Message
Fahad
Beginner User
Beginner User


Joined: 16 Mar 2004
Posts: 16

Post Post subject: optimized stand alone program Reply with quote

hi! can any one tell me how can i increase the performance of my java application, as it is relatively slow. Can i use other third perty program to help me here?

Fahad
Mon Apr 05, 04 3:33 am
Back to top
Fahad View user's profile Send private message Yahoo Messenger
dude
Power User
Power User


Joined: 10 Mar 2004
Posts: 376
Location: Savar, Dhaka

Post Post subject: Java and Common Sense Reply with quote

As far as I know, using the common sense while developing your Java applications is the bes measure. Here are few tips that I learned:

1. Get a profiler: a profiler adds up the cumulative execution time in each method of your code. Tools with good profilers let you drill down graphically, and find the coding sections that are requiring the most time. Everybody should have some kind of profiler (OptimizeIt, JProbe).

2. Stop memory leaks: Java virtual machines automate memory allocation, and use a technique called reachable objects to do garbage collection. An object is reachable if you can access it directly from some thread, or through a reference in another reachable object. When an object with a long life span keeps an unwanted reference to an unused object (like a static variable), you've got a leak. To solve memory leaks, you've got to be able to see the heap: the pool of all allocated objects. There's no good way to do so without a tool. Borland's Optimizeit Suite can help you with this.

3. Use a thred debugger to untangle your threads. Borland thread debugger is a good choice.
4. When you've finished developing and testing your code, recompile with compiler optimizations turned on (e.g., javac -O).

5. You can translate Java into C with this:
[http://www.webcity.co.jp/info/andoh/java/j2c.html]

and this:
[http://www.digiserve.com/nshaylor/jcc.html]

6. You should only use exceptions where you really need them.

7. The String concatenation operator + looks innocent but involves a lot of work: a new StringBuffer is created, the two arguments are added to it with append(), and the final result is converted back with a toString(). This costs both space and time.

8. Use classes from the Java API when they offer native machine performance that you can't match using Java. For example, arraycopy() is much faster than using a loop to copy an array of any significant size.

Here is also a link for u to chk out: [http://gee.cs.oswego.edu/dl/oosdw3/ch25.html]

On a high level you can use global register allocation. But I don't know much about it. Try searching on the net.
Mon Apr 05, 04 5:45 am
Back to top
dude View user's profile Send private message Visit poster's website
Fahad
Beginner User
Beginner User


Joined: 16 Mar 2004
Posts: 16

Post Post subject: Reply with quote

thanks dude, for ur informatic and helpful reply. but here if i use j2c to convert it into c will it work properly as my program has database connection too, And i think when i covert it into c it will b a machine dependent code.

so, how can i keep the program in java and optimize it's execution and function calls?

Fahad
Wed Apr 14, 04 8:04 am
Back to top
Fahad View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Programming in Java, C, C#, VB, .NET Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group