integer too slow
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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...
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...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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.
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.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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...
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...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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)
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)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by vanleth.
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
Static arrays in Blitz are declared with [] and in Mdkrsta example the arrays are decalred as dynamic() ones.TheBeck: Maybe this has something to do with PureBasic's dynamic arrays. Does BB use dynamic arrays? Just a thought.
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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)
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)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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...
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...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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

-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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.
However, GFA doesn't have much else in it's favour these days!
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm