Here is an Array-performance test written in Java. Be sure, that Jabaco.jar is in your classpath:
|
Jabaco Source
|
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
|
import VBA.*;
public class JabacoArrayTest {
public static void main(String[] args) {
int x,y;
long myTime;
for (int i=0; i<=5; i++) {
myTime = System.currentTimeMillis();
// initialize Java-Array
int javaArrayInt[][] = new int[2000][3000];
// fill Java-Array
for (y=0; y<=2999; y++) {
for (x=0; x<=1999; x++) {
javaArrayInt[x][y] = x+y;
}
}
System.out.println( i + ". turn with Java Array : " + (System.currentTimeMillis() - myTime) ); // time in milliseconds, the Java Array needs
try {
myTime = System.currentTimeMillis();
// initialize Jabaco-Array
VBArrayInteger jabacoArrayInt = new VBArray();
jabacoArrayInt.setBound(0, 2999, false);
jabacoArrayInt.addDimension(0, 1999, false);
// fill Jabaco-Array
for (y=0; y<=2999; y++) {
for (x=0; x<=1999; x++) {
jabacoArrayInt.getFromDimension(y).setValueInt(x, x+y);
}
}
System.out.println( i + ". turn with Jabaco Array: " + (System.currentTimeMillis() - myTime) ); // time in milliseconds, the Jabaco Array needs
} catch (Exception e) {
System.out.println(e);
}
System.out.println();
}
}
}
|
It generates and fills at first a two-dimensional Java-Array. Then it doing the same with an two-dimensional Jabaco-Array.
Then again with the Java Array and then again with the Jabaco Array. Fife times.
Additional it outputs how many milliseconds it needs to create and fill the array.
Greatings
theuserbl