-- JDK 1.5 ---
string time : 29913 ms
buffer time : 10 ms
string time : 11907 ms
buffer time : 11 ms
펼쳐두기..
JDK 버전
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
import java.util.Enumeration;
import java.util.Properties;
public class Version {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Properties p = System.getProperties();
Enumeration e = p.keys();
while(e.hasMoreElements()) {
String nm = (String)e.nextElement();
// System.out.println(nm + " : " + p.getProperty(nm));
}
StringBuffer sb = new StringBuffer();
long st = System.currentTimeMillis();
System.out.println("-- JDK 1.5 ---");
String result = "";
for (int i=0; i<=100; i++ ) {
result +="<tr>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >";
result +="테스트";
result +="</TD>";
result +="</tr>";
}
long en = System.currentTimeMillis();
System.out.println("string time : " + (en-st) + " ms");
StringBuilder sB = new StringBuilder();
st = System.currentTimeMillis();
for (int i=0; i<=1000; i++ ) {
sB.append("<tr>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sB.append("테스트");
sB.append("</TD>");
sB.append("</tr>");
}
en = System.currentTimeMillis();
System.out.println("builder time : " + (en-st) + " ms");
st = System.currentTimeMillis();
for (int i=0; i<=1000; i++ ) {
sb.append("<tr>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("<TD class=0 align=center bgcolor=#ffffff style='color:#000000' >");
sb.append("테스트");
sb.append("</TD>");
sb.append("</tr>");
}
en = System.currentTimeMillis();
System.out.println("buffer time : " + (en-st) + " ms");
}
}
No comments:
Post a Comment