blob: 4b56be7342943efd8ed37f3481c35baa5bfa77b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package test1;
class BenchProceedNew2 {
}
class BenchProceedNew3 {
int p, q;
BenchProceedNew3(int i, int j) {
p = i; q = j;
}
}
public class BenchProceedNew {
public static final int N = 10000000;
Object result0;
public int org0() {
long time = System.currentTimeMillis();
Object obj = null;
for (int i = N; i > 0; --i)
obj = new BenchProceedNew2();
long time2 = System.currentTimeMillis();
result0 = obj;
return (int)(time2 - time);
}
public int jvst0() {
long time = System.currentTimeMillis();
Object obj = null;
for (int i = N; i > 0; --i)
obj = new BenchProceedNew2();
long time2 = System.currentTimeMillis();
result0 = obj;
return (int)(time2 - time);
}
public int org2() {
long time = System.currentTimeMillis();
Object obj = null;
for (int i = N; i > 0; --i)
obj = new BenchProceedNew3(i, i);
long time2 = System.currentTimeMillis();
result0 = obj;
return (int)(time2 - time);
}
public int jvst2() {
long time = System.currentTimeMillis();
Object obj = null;
for (int i = N; i > 0; --i)
obj = new BenchProceedNew3(i, i);
long time2 = System.currentTimeMillis();
result0 = obj;
return (int)(time2 - time);
}
public static void main(String[] args) throws Exception {
BenchProceedNew bp = new BenchProceedNew();
System.out.println("iteration " + N);
System.out.println("org0 (msec) " + bp.org0());
System.out.println("jvst0 (msec) " + bp.jvst0());
System.out.println("org2 (msec) " + bp.org2());
System.out.println("jvst2 (msec) " + bp.jvst2());
System.out.println("org0 (msec) " + bp.org0());
System.out.println("jvst0 (msec) " + bp.jvst0());
System.out.println("org2 (msec) " + bp.org2());
System.out.println("jvst2 (msec) " + bp.jvst2());
}
}
|