Code: Select all
Speed Tests VB vs. PB in seconds
;File output
VB: .015625'5000 lines of "Hello"
PB: .015625 '5000 lines of "Hello"
VB: .109375 ' 50000 lines of "Hello"
PB: .328125 '50000 lines of "Hello"
;Loading Graphics
VB: .046875 'loading picture 50 X 50 100 times
PB: .093750 'loading picture 50 X 50 100 times
;Looping
VB: .390625 ' 10000000 times
VB: .468750 ' 10000000 times
;All three at once
PB: .8125 'all three tests
VB: .546875 'all three tests
all Tests done on a 700 Mhz System with 256 MB of RAM
I checked and double and triple checked all results
'If you wish to do these tests on your own, or If you think i did not
test it properly (which is probably more likely) here is the code for VB and PB
VBCODE:
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Sub Main()
Dim Start As Single, Finnish As Single, Math As Single
Dim lngX As Long
Start = timeGetTime / 1000
For lngX = 0 To 10000000
'Just a loop
Next lngX
For lngX = 0 To 100
vPicture = LoadPicture("C:\Test.bmp")
Next lngX
Open "C:\Test.txt" For Output As #1
For lngX = 0 To 50000
Print #1, "Hello"
Next lngX
Close #1
Finnish = timeGetTime / 1000
'Do math
Math = Finnish - Start
Debug.Print Math
End Sub
PBCode:
DefType.f fStart, fStop, fMath
DefType.l lX
fStart = timeGetTime_() / 1000
OpenFile(0,"C:\Test.txt")
For lX = 0 To 50000
WriteStringN("Hello")
Next lX
CloseFile(0)
For lX = 0 To 100
LoadImage(0,"C:\Test.bmp")
Next lX
For lX = 0 To 10000000
Next lX
fStop = timeGetTime_() / 1000
fMath = fStop - fStart
Debug fMath
I did the testing fairly, somewhat, I accually tried to optimize
PureBasic to make it go faster.
Now, I am not trying to Diss PureBasic. I have been
programming in Visual Basic for over 3 years and just started
PureBasic. Even though VB seems to be faster than PB, I still
prefer PureBasic over Visual Basic.
I did not test graphics output. PureBasic maybe faster.
But I defently choose PureBasic over Visual Basic!!!