You are not logged in.

neilnapier

Beginner

  • "neilnapier" started this thread

Posts: 3

Date of registration: Mar 6th 2009

  • Send private message

1

Friday, March 6th 2009, 6:11pm

Speed comparison and SetPixelV

I was very interested in this langauge mostly because it meant I would be able to program in VB6 for multiple platforms. However, I considered the speed boosting oppertunities.

I tested the speed with a simple code...

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Private Sub Timer1_Timer()
r = Timer
Do Until xx = 1
 Text1.Text = Val(Text1.Text) + 1
DoEvents
If Val(Text1.Text) = 100000 Then
   If (Timer - r) > 0 Then
        fps = (1 / (Timer - r))
    End If
    
MsgBox (fps)
xx = 1
End If
Loop
End Sub


This shown that Jabaco is much faster than VB6. Naturly, however I wasn't conviced and I was wondering if someone could state whether the speed has improved.

My next question is about the use of SetPixelV. Because Jabaco has no .hdc I can't use it as I normally would. How would I go about using it?

Thank you for taking the time to read this, and thanks to any help that can be given.

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

2

Friday, March 6th 2009, 6:33pm

For the german users:

Jabaco Source

1
Text1.Text = cInt(Text1.Text) + 1

A nice test. Btw: I'll create some benchmarks for a better performance-overview within the next few month.

Quoted

My next question is about the use of SetPixelV. Because Jabaco has no .hdc I can't use it as I normally would. How would I go about using it?
It's not recommended for Swing-based software. You should use a Java or Jabaco-function:

Jabaco Source

1
2
3
Me.PSet x, y
Me.Line x1, y1, x2, y2
Me.ContentFrame.GetGraphics.drawLine x1, y1, x2, y2

neilnapier

Beginner

  • "neilnapier" started this thread

Posts: 3

Date of registration: Mar 6th 2009

  • Send private message

3

Friday, March 6th 2009, 7:53pm

Thanks.

Athough, the reason I wanted SetPixelV is because I need to have multiple colours.

Also, when I put a Do loop into Sub Main it doesn't load the form, no matter what I do.

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

4

Friday, March 6th 2009, 8:16pm

Quoted

Athough, the reason I wanted SetPixelV is because I need to have multiple colours.

Jabaco Source

1
2
Me.ForeColor = RGB(r, g, b)
Me.PSet x, y

Further informations about 2D graphic-methods: http://java.sun.com/docs/books/tutorial/2d/index.html

Quoted

Also, when I put a Do loop into Sub Main it doesn't load the form, no matter what I do.
Could you attach your sample-source? I can't reproduce.

neilnapier

Beginner

  • "neilnapier" started this thread

Posts: 3

Date of registration: Mar 6th 2009

  • Send private message

5

Friday, March 6th 2009, 10:01pm

Source code

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
Public Sub main(ByJava args() As String) 
Dim myArgs() As String 
myArgs = args 
Form1.SetDefaultClose() 
Form1.show() 
Do 

Dim i As Long 
Dim negpos As Byte 
Dim n As Single 
form1.sandbox.Cls 
For i = LBound(xy()) + 1 To UBound(xy()) 
' Resets pixels when they go past the border 
' If pixels are within the sandbox then they will be read 
If xy(i).y > 0 Then 
form1.sandbox.pset(xy(i).x,xy(i).y) 
' Setpixelv form1.sandbox , xy(i).x,xy(i).y,rgb(200,200,200) 

' Creates a random variable 
Randomize 
negpos = Int(Rnd + Rnd) + 1 
If negpos = 1 Then 
n = (-1 * xy(i).slip) 
ElseIf negpos = 2 Then 
n = xy(i).slip 
End If 
xy(i).y = xy(i).y + xy(i).weight 
xy(i).x = xy(i).x + n 
End If 

Next i 
Doevents 
Loop 
Unload


There you go :D



EDIT: Hm... I *may* have got it to work.. but I still need to fix an error to do with a null reference.

EDIT2: I'm kind of in need of having pixels with specific colours, because I redraw them every frame, and so I would need to change the forecolour every fraction of a frame.

This seems to be much more faster than VB6 when having a large array but much slower at creating them.

This post has been edited 2 times, last edit by "neilnapier" (Mar 8th 2009, 5:49pm)


Rate this thread
WoltLab Burning Board