Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Optimizing in Java... is it even possible?

Status
Not open for further replies.

PerD

Programmer
May 4, 2000
12
SE
Hi

Is it even possible to optimize anything in Java?

When talking about C, there's always optimizing in the picture. With Java though, it seems to be different.
Anyone who got some info on this?

/Regards Per
/Regards Per
 
There are lots of ways to optimise Java.

I have found that most problems are caused by program design drifting away from object oriented concepts. My advice would be to sharpen up on OO and UML skills.

Another place for quick gains is re-using objects. One of the slowest things to do is instantiate a new object. Many times you can just get rid of the contents and replace with other stuff (e.g. a display frame).

The second slowest thing to do is garbage collection. If you create and throw away fewer objects then there is less to be cleaned up.

There are different JVMs available that compile up faster code. Although most speed problems are due to high memory usage and not byte code speed.

Performance 'tricks' are normally for fairly advanced programmers. My first point will normally help all levels of programmer. My home ----> My company ->
 
Thanx for the info!

Do you have information on these "performance tricks" too?

/Regards Per
 
there are some tricks for optimising by reading a bit of how bytecode is done.
If you use less than 5 variables (standard types, or reference (not sure for this one)) in a loop, they will be use through some special bytecode functions that can make your routine faster.
 
Thanx for the info both of you!

I'll take a look at your webpage...


/Regards Per
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top