Page 1 of 2
Speed tests: VB vs. PB
Posted: Thu Feb 12, 2004 4:04 pm
by nci
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!!!
Posted: Thu Feb 12, 2004 4:21 pm
by LarsG
I just wanted to say that comparing empty loops is a waste of time, as it will never be used in any application (well, maybe as a delay..)..
It would be a better comparison of you included some sort of a complex math formula, or some sorting algorithm, or something..
just my 2 cents, anyways...
Posted: Thu Feb 12, 2004 4:27 pm
by tinman
You're running the tests with the debugger on.
Posted: Thu Feb 12, 2004 5:07 pm
by nci
I will try the test with the debugger off.
Posted: Thu Feb 12, 2004 5:47 pm
by nci
Code: Select all
Speed Tests VB vs. PB in seconds
PB: 1.578125 Seconds
VB: 7.28125 Seconds
WOW!!!!!!!!!!!!!!!!!!!!!!!!!1
Purebasic wips vb's butt!!!!!!!!!!!!!!1
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
X = 45 * Sin(87356) * Sqr(78945)
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
X = 45 * Sin(87356) * Sqr(78945)
Next lX
fStop = timeGetTime_() / 1000
fMath = fStop - fStart
MessageRequester("Time" , StrF(fMath),0)
I included a math operation done 10 million times and boy does
VB blow
PureBasic did it in less than 2 seconds and VB took almost 8
Thanks for setting me staight and proving me wrong. ( I was hoping
someone would)
Fred, you made an awsome language!
Posted: Fri Feb 13, 2004 5:29 am
by pthien
I don't know if I'm getting punchy because I'm sleep-deprived or what, but these types of posts are getting kinda funny. Let me summarize:
(Original Post) Hey guys, PB is much slower than VB. Look at the differences here.
(Immediate Reply) Turn the debugger off.
(Follow-up) Oh, yeah, PB is really much faster than VB.
Posted: Fri Feb 13, 2004 11:05 am
by Fred
..
Posted: Fri Feb 13, 2004 11:42 am
by NoahPhense
nci wrote:Code: Select all
Speed Tests VB vs. PB in seconds
PB: 1.578125 Seconds
VB: 7.28125 Seconds
WOW!!!!!!!!!!!!!!!!!!!!!!!!!1
Purebasic wips vb's butt!!!!!!!!!!!!!!1
Fred, you made an awsome language![/quote]
Gotta get ya a bumper sticker:
"My son thought VB was faster than PB, boy did I show him.."
and
"My other language [i]was [/i]VB.."
..lol
- np
ps - does VB still need one of those over-weight (RT) DLL's to function correctly?
Posted: Fri Feb 13, 2004 12:59 pm
by GedB
ps - does VB still need one of those over-weight (RT) DLL's to function correctly?
Yes, but its been included with windows for so long that people just think of it as part of the operating system.
Posted: Fri Feb 13, 2004 1:21 pm
by GeoTrail
The setup file with the vb6 runtime is about 1.3 mb.
That's one of the reasons I'm here now

Posted: Fri Feb 13, 2004 3:02 pm
by nci
I'm not sure if you noticed, but I think I said I was making a mistake.
I wanted someone to show me what I was doing wrong
I just started PureBasic not too long ago, I'm still learning. I was intending
for someone to show me why VB seemed faster. I new it wasn't true but
I didn't now why it was happening.
Posted: Fri Feb 13, 2004 3:50 pm
by blueb
Please don't take the comments badly Eric.
You're just finding out what all of us on this forum already know.
PureBasic can do
almost anything, but small details will make a difference.
Welcome to the forum.
--blueb
Posted: Fri Feb 13, 2004 8:34 pm
by nci
I understand.
I new it had to be faster, I just didn't now how fast
doing these tests showed some incredible results!
I just had to find out for my self
These huge runtime dll's that microsoft has is one of the biggest
(pardon the pun) reasons I switched to PB. I love PB.
Later
Posted: Sat Feb 14, 2004 1:24 am
by Shannara
pthien wrote:(Follow-up) Oh, yeah, PB is really much faster than VB.

:D Almost true
viewtopic.php?t=9002&highlight=
Posted: Sat Feb 14, 2004 1:29 am
by GeoTrail
nci wrote:I update my signiture daily
Last updated: July 12, 1997 at 5:06 PM
good one nci 