JVM optimization
- From: "ilkinulas" <ilkinulas@xxxxxxxxx>
- Date: 9 May 2005 01:12:30 -0700
Hi,
two functions test1 and test2 does the same thing but test2 performs
nearly 20 times better than test1. JVM is unable to optimize the code
in test1. is there a way to tell the java virtual machine to do this
kind of optimization at compile time or runtime?
NOTE : we are using Log4J and java version "1.4.2_02"
private static final Logger log = Logger.getLogger(DebugTest.class);
--------------------------------------------------------------------------
public void test1() {
for (int i = 0; i < 10000000;i++) {
String s ="test"+i;
if(log.isDebugEnabled()) {
log.debug(s);
}
}
}
public void test2() {
for (int i = 0; i < 10000000;i++) {
if(log.isDebugEnabled()) {
String s ="test"+i;
log.debug(s);
}
}
}
--------------------------------------------------------------------------
.
- Follow-Ups:
- Re: JVM optimization
- From: Kevin McMurtrie
- Re: JVM optimization
- From: Tim Tyler
- Re: JVM optimization
- From: bugbear
- Re: JVM optimization
- From: Thomas Schodt
- Re: JVM optimization
- Prev by Date: Problem with JComboBox
- Next by Date: Re: Non-blocking method for reading writing objects to sockets
- Previous by thread: Problem with JComboBox
- Next by thread: Re: JVM optimization
- Index(es):
Relevant Pages
|