mmgt; java VectorInd 1000000
Insert Time [749] : 11
Insert Time [61480] : 6
Insert Time [122880] : 48
Insert Time [245760] : 70
Insert Time [491520] : 113
Insert Time [983040] : 215
Insert Time [983917] : 18
Appendix A
[VectorTest.java]
import java.util.Vector;
import java.util.Calendar;
public class VectorTest {
public static void main(String[] args) {
Vector target = new Vector();
String obj = new String("Vector Data");
Calendar start, end;
long interval = 0;
long LIMIT = 0;
int index = 0;
long MAX = Long.parseLong(args[0]);
for ( LIMIT = MAX / 10 ; LIMIT <= MAX ; LIMIT = LIMIT + MAX/10 ) {
start = Calendar.getInstance();
for ( index=0 ; index < LIMIT ; index++) {
target.add(index, obj);
}
end = Calendar.getInstance();
interval = end.getTimeInMillis() - start.getTimeInMillis();
System.out.println(index + " " + interval);
target = new Vector();
}
System.out.println("===========================");
for ( LIMIT = MAX / 10 ; LIMIT <= MAX ; LIMIT = LIMIT + MAX/10 ) {
start = Calendar.getInstance();
for ( index=0 ; index < LIMIT ; index++) {
target.add(0, obj);
}
end = Calendar.getInstance();
interval = end.getTimeInMillis() - start.getTimeInMillis();
System.out.println(index + " " + interval);
target = new Vector();
}
}
}
[VectorInd.java]
import java.util.Vector;
import java.util.Calendar;
public class VectorInd {
public static void main(String[] args) {
Vector target = new Vector(30);
Object obj = new Object();
Calendar start, end;
long interval = 0;
int LIMIT = Integer.parseInt(args[0]);
for ( int index = 0 ; index <= LIMIT ; index++ ) {
start = Calendar.getInstance();
target.add(obj);
end = Calendar.getInstance();
interval = end.getTimeInMillis() - start.getTimeInMillis();
if ( interval > 3 ) {
System.out.println("Insert Time : " + interval);
}
}
}
}
이전 글 : 임베디드 리눅스 개발 환경에 관한 이해와 개발
다음 글 : 반드시 알아야 할 ASP 코딩 습관
최신 콘텐츠