Benchmark speed?

DaveW

Active Member
Licensed User
I just did some benchmark speed tests of Basic4PPC compared to NSBasic. I was a bit disappointed with the results. The test is one used by NSB to compare PDAs and is very simple (simplistic really) but good enough for a rough comparison. The code is just a one line loop to see how many iterations can be done in 10 sec:

Sub App_Start
Form1.Show
WaitCursor(True)
Dim limit, counter
limit = TimeAdd(Now, 0, 0, 10)
counter = 0
Do Until Now > limit
counter = counter + 1
Loop
WaitCursor(False)
Msgbox(counter/10 & " iterations per second")
End Sub

I ran this on my PDA in both IDE and compiled forms and got values of about 500 and 1100. The same code in NSBasic on the same PDA was 11000 - 10 times faster than B4PPC!

Is this purely down to .NET?

(By the way, I have no intentions of going back to NSB, even with this difference. The development speed in B4PPC is 10 times faster than NSB!)
 

Erel

Administrator
Staff member
Licensed User
Did you use the optimized compiler?
This is not purely down to .Net as Basic4ppc can and will improve in the field of calculations speed.
However there are many other factors that also affect the overall performance of an application.
 

ceaser

Active Member
Licensed User
Hi Dave

I have used NSB for about 3 years and I am very disappointed that I have not used Basic4PPC earlier. I have wasted 3 years of my life!:sign0137:

On the speed issue. When I load a combobox with say 2000 coordinate points in NSB, I wait forever. However in B4PPC it is almost immediatly! Also, I use a lot of maths in my Land Surveying program and I have found B4PPC to be much faster than NSB in processing the maths!

Regards
Michael
 

Erel

Administrator
Staff member
Licensed User
You can test the following code (optimized compile it):
B4X:
Sub Globals
    Dim limit(1) As double
    Dim counter(1) As double
End Sub

Sub App_Start
    WaitCursor(True)
    limit(0) = TimeAdd(Now, 0, 0, 10)
    counter(0) = 0
    Do Until Now > limit(0)
        counter(0) = counter(0) + 1
    Loop
    WaitCursor(False)
    Msgbox(counter(0)/10 & " iterations per second")
End Sub
On a WM2003 device it shows about 11500 iterations per second.
The difference is that regular variables are untyped unlike arrays which you can declare with a specific type.
In one of the next versions this feature of declaring types of regular variables will be added.
Again, as ceaser wrote there are other factors that also affect the overall performance of your application.
 

DaveW

Active Member
Licensed User
Erel,

FIrst I need to reiterate that I am still very happy to have moved to Basic4PPC! I have got more coding done in a week than I did in months on NSBasic, it has (generally - see my other posts) been a simple process, debugging is a dream in comparison and the potential to push the limits of what my program will do are far greater. In fact the only problems I have had are in trying to do things I would never had contemplated doing in NSB.

Anyway, yes I was using the optimised compiler. I tried the new code and it did improve - this time I got 3500, over 3 times faster but still 1/3 the speed of NSBasic.

I am sure you are right that in other comparisons the results would be very different.

I only got interested in benchmarking because my program is reading and parsing some text files and as that was taking an appreciable time even on the PC and I wanted to see how the PDA would do. By the way the new benchmark clocks 56000 in the Windows IDE and 1,800,000 as a compiled exe!
 
Top