static long l_test6_start;
static long l_test6_end;
static void test6() {
int l_cnt = 0;
l_test6_start = System.currentTimeMillis();
for(; l_cnt<1000; l_cnt++) {
System.out.println(Test.class.getName());
}
l_test6_end = System.currentTimeMillis();
}
static long l_test7_start;
static long l_test7_end;
static void test7() {
int l_cnt = 0;
String l_str = Test.class.getName();
l_test7_start = System.currentTimeMillis();
for(; l_cnt<1000; l_cnt++) {
System.out.println(l_str);
}
l_test7_end = System.currentTimeMillis();
}
private static int tc9() {
test6();
test7();
System.out.println("l_test6_start: " + l_test6_start);
System.out.println("l_test6_end: " + l_test6_end);
System.out.println("l_test7_start: " + l_test7_start);
System.out.println("l_test7_end: " + l_test7_end);
return 1;
}
=>
l_test6_start: 1244947661702
l_test6_end: 1244947661764 // 62 msec 차이를 보임
l_test7_start: 1244947661764
l_test7_end: 1244947661796 // 32 msec 차이를 보임
'Java Programming' 카테고리의 다른 글
Find out the directory (0) | 2009.07.03 |
---|---|
display long value with ',' seperator (0) | 2009.06.29 |
loop 안과 밖의 try/catch에 따른 performance (0) | 2009.06.08 |
String vs. StringBuffer vs. StringBuilder (0) | 2009.06.08 |
object reference 전달 (0) | 2009.06.04 |