Bugz: VB6 vs VB.NET comparison
Hi Bugz.
Here's some code so we can test the relative speeds of VB6 and VB.NET. Can you run it on VB6 and VB.NET and let me know the results (as well as CPU speeds of each machine)?
Just for reference, it ran in 13.5 seconds on my computer: VB6, AMD XP1600+.
Feel free to change any of the tests if you want.
Make sure to change the Long/Double datatypes in VB.NET if needed - I seem to remember Microsoft changed Long to Integer or something. Just as long as the test is fair...
VB Code:
Declare Function GetTickCount Lib "kernel32.dll" () As Long
Sub Main()
'Program to test relative speed of VB6 vs VB.NET
'Tests mathematical operations
'Coded 10.8.02
Dim x As Long
Dim z As Double
Dim start As Long
MsgBox "Press OK to begin mathematical operations. Tests should take <1 minute."
start = GetTickCount
'Basic operations, integer & floating point
For x = 0 To 10000000
z = 17 + 56 / (9 * 263) - 78 / (2.2 * 9)
Next
'Rnd
For x = 0 To 1000000
z = Rnd
Next
'Trig functions
For x = 0 To 10000000
z = Sin(23.5687)
z = Cos(23.5687)
z = Tan(23.5687)
z = Atn(23.5687)
Next
'Sqr
For x = 0 To 10000000
z = Sqr(2315.126)
Next
'Exp & log
For x = 0 To 10000000
z = Exp(22.561)
z = Log(22.561)
Next x
MsgBox (GetTickCount() - start) / 1000 & " seconds elapsed."
End Sub