Speed tests: VB vs. PB

Everything else that doesn't fall into one of the other PB categories.
nci
User
User
Posts: 28
Joined: Mon Jul 28, 2003 6:03 pm

Speed tests: VB vs. PB

Post 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!!!
Neptune Century Inc.
Eric Butler, CEO, Lead programmer

"The road to happiness never ends..."
LarsG
Enthusiast
Enthusiast
Posts: 713
Joined: Mon Jun 02, 2003 1:06 pm
Location: Norway
Contact:

Post 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...

AMD Athlon XP2400, 512 MB RAM, Hercules 3D Prophet 9600 256MB RAM, WinXP
PIII 800MHz, 320 MB RAM, Nvidia Riva Tnt 2 Mach 64 (32MB), WinXP + Linux
17" iMac, 1.8 GHz G5, 512 MB DDR-RAM, 80 GB HD, 64 MB Geforce FX 5200, SuperDrive, OSX
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

Post by tinman »

You're running the tests with the debugger on.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
nci
User
User
Posts: 28
Joined: Mon Jul 28, 2003 6:03 pm

Post by nci »

I will try the test with the debugger off.
Neptune Century Inc.
Eric Butler, CEO, Lead programmer

"The road to happiness never ends..."
nci
User
User
Posts: 28
Joined: Mon Jul 28, 2003 6:03 pm

Post 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!
Neptune Century Inc.
Eric Butler, CEO, Lead programmer

"The road to happiness never ends..."
pthien
Enthusiast
Enthusiast
Posts: 148
Joined: Sun Jun 29, 2003 9:39 pm

Post 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.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

:lol:
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

..

Post 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?
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post 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.
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

The setup file with the vb6 runtime is about 1.3 mb.
That's one of the reasons I'm here now :lol:
nci
User
User
Posts: 28
Joined: Mon Jul 28, 2003 6:03 pm

Post 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.
Neptune Century Inc.
Eric Butler, CEO, Lead programmer

"The road to happiness never ends..."
User avatar
blueb
Addict
Addict
Posts: 1111
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post 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. :D

Welcome to the forum.

--blueb
nci
User
User
Posts: 28
Joined: Mon Jul 28, 2003 6:03 pm

Post by nci »

I understand. :D
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 :D

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
Neptune Century Inc.
Eric Butler, CEO, Lead programmer

"The road to happiness never ends..."
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post by Shannara »

pthien wrote:(Follow-up) Oh, yeah, PB is really much faster than VB.
:):D Almost true :)
viewtopic.php?t=9002&highlight=
User avatar
GeoTrail
Addict
Addict
Posts: 2794
Joined: Fri Feb 13, 2004 12:45 am
Location: Bergen, Norway
Contact:

Post by GeoTrail »

nci wrote:I update my signiture daily
Last updated: July 12, 1997 at 5:06 PM
:lol: good one nci :lol:
Post Reply