Olav
2010-06-04 09:45:46 UTC
It has always been said that Powerbasic is so fast, especially compared to
Visual Basic, but I think this no longer is true.
FUNCTION PBMAIN () AS LONG
LOCAL z,i AS SINGLE
REGISTER Counter&
REGISTER x##, y##
x## = 1
y## = 0.00001
i = TIMER
FOR Counter& = 1 TO 1000000000
x## = x## * y##
NEXT
z = TIMER - i
? STR$(z)
? "Press a key to end the program..."
WAITKEY$
END FUNCTION
//////////////////////Visual Basic 2010/////////////////////////////
Sub Main()
Dim start_time As DateTime
Dim stop_time As DateTime
Dim elapsed_time As TimeSpan
Dim Counter As Integer
Dim x, y As Double
x = 1
y = 0.00001
start_time = Now()
For Counter = 1 To 1000000000
x = x * y
Next
stop_time = Now()
elapsed_time = stop_time.Subtract(start_time)
Console.WriteLine(elapsed_time.TotalSeconds().ToString)
Console.Read() 'CTRL + F5 within the IDE halts the console
End Sub
/////////////////////////////Code
Ends//////////////////////////////////////////////////
And here are the results:
Debug mode No debugger
Powerbasic Unknown 2.76 secs
Visual Basic 10 secs 1 sec
Powerbasic result, while run in the debugger, is unknown because I canceled
the test after about 4 - FOUR- hours time. It was at that time still
running.
--
Olav
?
Visual Basic, but I think this no longer is true.
FUNCTION PBMAIN () AS LONG
LOCAL z,i AS SINGLE
REGISTER Counter&
REGISTER x##, y##
x## = 1
y## = 0.00001
i = TIMER
FOR Counter& = 1 TO 1000000000
x## = x## * y##
NEXT
z = TIMER - i
? STR$(z)
? "Press a key to end the program..."
WAITKEY$
END FUNCTION
//////////////////////Visual Basic 2010/////////////////////////////
Sub Main()
Dim start_time As DateTime
Dim stop_time As DateTime
Dim elapsed_time As TimeSpan
Dim Counter As Integer
Dim x, y As Double
x = 1
y = 0.00001
start_time = Now()
For Counter = 1 To 1000000000
x = x * y
Next
stop_time = Now()
elapsed_time = stop_time.Subtract(start_time)
Console.WriteLine(elapsed_time.TotalSeconds().ToString)
Console.Read() 'CTRL + F5 within the IDE halts the console
End Sub
/////////////////////////////Code
Ends//////////////////////////////////////////////////
And here are the results:
Debug mode No debugger
Powerbasic Unknown 2.76 secs
Visual Basic 10 secs 1 sec
Powerbasic result, while run in the debugger, is unknown because I canceled
the test after about 4 - FOUR- hours time. It was at that time still
running.
--
Olav
?