You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

1

Saturday, June 29th 2013, 3:29pm

Array performance test in Java

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

IAO

Beginner

  • "IAO" is male

Posts: 38

Date of registration: May 25th 2013

Location: Venezuela

Occupation: Electronic

  • Send private message

2

Sunday, June 30th 2013, 2:16am

Hello to all..

Hi mr. theuserbl:
Days ago, I asked myself:
Is it possible to make Java programs with the framework jabaco.jar?

You have given me the answer. :)

Thanks for sharing the code. I continue studying arrays.


Best wishes...

.

This post has been edited 1 times, last edit by "IAO" (Jun 30th 2013, 2:22am)


theuserbl

Intermediate

  • "theuserbl" started this thread

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

3

Sunday, June 30th 2013, 2:26am

Days ago, I asked myself:
Is it possible to make Java programs with the framework jabaco.jar?


I think, then this will intests you:
http://www.jabaco.org/board/p2150-fun-wi…oframework.html


... and if you want to know, how the IDE-Designer works:
http://www.jabaco.org/board/p1957-jabacoide-internals.html

Greatings
theuserbl

IAO

Beginner

  • "IAO" is male

Posts: 38

Date of registration: May 25th 2013

Location: Venezuela

Occupation: Electronic

  • Send private message

4

Sunday, June 30th 2013, 2:36am

Hi...

I can see that "Jabaco" takes more milliseconds to generate and fill the array.

WOW BeanShell.
I'll calmly read this link to understand everything. Thank you.
There are many things to learn. Thank you.

Greatings


.

IAO

Beginner

  • "IAO" is male

Posts: 38

Date of registration: May 25th 2013

Location: Venezuela

Occupation: Electronic

  • Send private message

5

Sunday, June 30th 2013, 6:28pm

Hi...

mr. theuserbl:
Your tutorial worked perfect.

Thank you very much for sharing this BeanShell.
I use with Jabaco-rev105.jar.
You are a great man, a * hacker *. ;)


Happy day to all and best wishes.


.

Rate this thread
WoltLab Burning Board