Page 1 of 3

Posted: Sat Feb 08, 2003 6:26 pm
by BackupUser
Restored from previous forum. Originally posted by mdkrsta.

BlitzBasic is 2x faster with integer addition/subtraction. Why is this and will PureBasic be optimized for that in the future?

Posted: Sat Feb 08, 2003 6:40 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

Hi mdkrsta,
first welcome to pure... Please give us an example how do you did the test. Please post us both sources (blitz and pure one), so we can see what happen. If you tried the test with pure demo version, you must know, that the demo versions runs all time in debug mode (also enabled debugger) - this will ofcourse slow down any innerloop...

@ Fred, maybe it would make sence, to disable the debugger or set it optional, even in the demo version... So ppl can test it and see the full power of pure instead only some percent due fact of the enablde debugger thing!

greetz
MrVainSCL! aka Thorsten

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...

Posted: Sat Feb 08, 2003 8:19 pm
by BackupUser
Restored from previous forum. Originally posted by mdkrsta.

I'm using the full version with Debugger disabled. The demo can also be tuned using the DisableDebugger command.

As I found out, arrays are slower in PB. Even normal integer arithmetic is a bit slower. Maybe Fred can do some "comparisons" to make his Basic the fastest available.

Here is the code for PureBasic (needs 17 sec):
OpenConsole()
ti=gettickcount_()
Dim a(10)
b=2
For i=1 To 500000000
a(1)=a(2)+a(3)
a(b)=a(1)-a(2)
a(2)=17+i
a(3)=100-a(2)
Next
res=Print(Str(gettickcount_()-ti))
a$=Input()

The same code for BlitzBasic (needs 9 sec):
ti=MilliSecs()
Dim a(10)
b=2
For i=1 To 500000000
a(1)=a(2)+a(3)
a(b)=a(1)-a(2)
a(2)=17+i
a(3)=100-a(2)
Next
Print MilliSecs()-ti

Posted: Sat Feb 08, 2003 8:34 pm
by BackupUser
Restored from previous forum. Originally posted by koehler.


Hmm, I am also getting 10s in Blitzm, and 17.996 in PB.

Of course, its still pretty amazing that a simple Basic-like language can give 2+ BILLION operations in 10-20s.

Guess we can now sit on the edge of our chair waiting to see how much Fred can optimize this,
pass the popcorn please....

--
1980 Applesoft Basic, '81 6502 Assembler, '82 Pascal, '96 C, '00 Blitz Basic
2003 Pure Basic - History does repeat itself.

Posted: Sat Feb 08, 2003 9:13 pm
by BackupUser
Restored from previous forum. Originally posted by MrVainSCL.

Ohhhh... here are my results... tested with PB3.51 and B3D v1.80

PureBasic: 52024 and 52335
Blitz3D..: 45779 and 45327


greetz
MrVainSCL! aka Thorsten

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX9.0, SB AWE64, Win2000 + all Updates...

Posted: Sun Feb 09, 2003 12:03 am
by BackupUser
Restored from previous forum. Originally posted by tinman.

BlitzBasic 2D v1.69: 30896
PureBasic: 24580

I couldn't test with any newer version of BB since I found that on a magazine CD, and you cannot get updates. If someone wants to send me an exe with the BB code compiled in a newer or BB3D version I'll run it to get more up-to-date comparison.

Duron 750, 256Mb PC133.


--
It's not minimalist - I'm increasing efficiency by reducing input effort.
(Win98first ed. + all updates, PB3.51, Ed3.53)

Posted: Sun Feb 09, 2003 4:33 am
by BackupUser
Restored from previous forum. Originally posted by TheBeck.

Maybe this has something to do with PureBasic's dynamic arrays. Does BB use dynamic arrays? Just a thought.

Posted: Sun Feb 09, 2003 1:37 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

I will take a closer look. Thanks to point this out !

Fred - AlphaSND

Posted: Sun Feb 09, 2003 4:58 pm
by BackupUser
Restored from previous forum. Originally posted by vanleth.
TheBeck: Maybe this has something to do with PureBasic's dynamic arrays. Does BB use dynamic arrays? Just a thought.
Static arrays in Blitz are declared with [] and in Mdkrsta example the arrays are decalred as dynamic() ones.

The PB manual says: "Arrays are always globally accessable in PureBasic.". Maybe it can be something with access to local vs. global data.
Or that the linked lists in blitz is faster than PB's ones if linked lists are used to handle dynamic arrays.

My Thoughts

Van

Posted: Sun Feb 09, 2003 8:24 pm
by BackupUser
Restored from previous forum. Originally posted by Danilo.

The plain 'For...Next' loop should be faster in BlitzBasic too,
so it has nothing to do with arrays only, its the whole
optimization thing. This is already known for quite some time... :)

Somebody made some tests in PB, VB, VC++, BC++, ..
and PureBasic has lost the tests without a problem.
Dont care and buy PureBasic anyway! :)

cya,
...Danilo
(registered PureBasic user)

Posted: Sun Feb 09, 2003 10:05 pm
by BackupUser
Restored from previous forum. Originally posted by mdkrsta.

I also did some testing with various Basic Compilers, C++ and Assembler for integer performance. PB is one of the fastest compilers, very near optimized C++ code. If Fred really does some tuning for v4.0 I think PB will be the fastest Basic compiler available.

But because a compiler must be flexible it will never be as fast as optimized assembler code. That's where the inline ASM function becomes handy...

Posted: Wed Mar 19, 2003 11:41 am
by BackupUser
Restored from previous forum. Originally posted by fred.

Ok, can someone make the test again with the lastest version of PB (3.61) ? On Danilo's computer, it gives the following results:

- BB 1.76: 16 secs
- PB 3.61: 10 secs


Fred - AlphaSND

Posted: Thu Mar 20, 2003 12:54 pm
by BackupUser
Restored from previous forum. Originally posted by mdkrsta.

As with every benchmark you have to run the test several times because Windoze may do something in the background. The best way is to run it 3 times and take the best result.

On a P4 1.7GHz I get the following:

BB 1.60: 9.648 sec
PB 3.61: 8.653 sec

You beat him on this one now :)

Posted: Thu Mar 20, 2003 5:20 pm
by BackupUser
Restored from previous forum. Originally posted by geoff.

Simple math on a 2D float array.
This benchmark runs nearly twice as fast using my 1993 GFA Basic 16 bit compiler with 64 bit floats compared with PureBasic 3.61 and 32 bit floats.

Code: Select all

For k=1 to 100
  For i=1 To 60
    For j=1 To 60
      a.f(i,j)=99+i+j/1.23
    Next j
  Next i
  For n=1 To 55
    For i=1 To 59
      For j=1 To 59
        a(i,j)=(a(i+1,j)+a(i,j+1))*0.5-3.9*a(i,j)/1000
      Next j
    Next i
  Next n
Next k
However, GFA doesn't have much else in it's favour these days!

Posted: Thu Mar 20, 2003 7:58 pm
by BackupUser
Restored from previous forum. Originally posted by mdkrsta.

Floats and mathematical functions have not been a focus for Fred yet. This indeed needs some improvement in the future.

Anyway, the topic of this thread was integer array performance. Most 2D games and Win apps do not need floats at all.