home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- BackColor = &H00000000&
- BorderStyle = 1 'Fixed Single
- Caption = "Binary Shifting Speed Test"
- ClientHeight = 3105
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 4680
- LinkTopic = "Form1"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3105
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command4
- Caption = "Binary shift"
- Height = 255
- Left = 2400
- TabIndex = 7
- Top = 2280
- Width = 2175
- End
- Begin VB.CommandButton Command3
- Caption = "VB multiply"
- Height = 255
- Left = 120
- TabIndex = 6
- Top = 2280
- Width = 2175
- End
- Begin VB.CommandButton Command2
- Caption = "Binary shift"
- Height = 255
- Left = 2400
- TabIndex = 3
- Top = 1440
- Width = 2175
- End
- Begin VB.CommandButton Command1
- Caption = "VB divide"
- Height = 255
- Left = 120
- TabIndex = 2
- Top = 1440
- Width = 2175
- End
- Begin VB.TextBox Text1
- Alignment = 2 'Center
- BackColor = &H00000000&
- BorderStyle = 0 'None
- BeginProperty Font
- Name = "Comic Sans MS"
- Size = 12
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00C00000&
- Height = 285
- Left = 120
- TabIndex = 0
- Text = "1000000"
- Top = 600
- Width = 4455
- End
- Begin VB.Label Label5
- Alignment = 2 'Center
- BackColor = &H00000000&
- BeginProperty Font
- Name = "Comic Sans MS"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 2400
- TabIndex = 9
- Top = 2640
- Width = 2175
- End
- Begin VB.Label Label4
- Alignment = 2 'Center
- BackColor = &H00000000&
- BeginProperty Font
- Name = "Comic Sans MS"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 120
- TabIndex = 8
- Top = 2640
- Width = 2175
- End
- Begin VB.Label Label3
- Alignment = 2 'Center
- BackColor = &H00000000&
- BeginProperty Font
- Name = "Comic Sans MS"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 2400
- TabIndex = 5
- Top = 1800
- Width = 2175
- End
- Begin VB.Label Label2
- Alignment = 2 'Center
- BackColor = &H00000000&
- BeginProperty Font
- Name = "Comic Sans MS"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 375
- Left = 120
- TabIndex = 4
- Top = 1800
- Width = 2175
- End
- Begin VB.Label Label1
- Alignment = 2 'Center
- BackColor = &H00000000&
- Caption = "Number of iterations"
- BeginProperty Font
- Name = "Comic Sans MS"
- Size = 15.75
- Charset = 0
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H000000FF&
- Height = 495
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 4455
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- If IsNumeric(Text1.Text) Then Call VBDivide(Text1.Text)
- End Sub
- Private Sub Command2_Click()
- If IsNumeric(Text1.Text) Then Call BSDivide(Text1.Text)
- End Sub
- Private Sub Command3_Click()
- If IsNumeric(Text1.Text) Then Call VBMultiply(Text1.Text)
- End Sub
- Private Sub Command4_Click()
- If IsNumeric(Text1.Text) Then Call BSMultiply(Text1.Text)
- End Sub
- Private Sub VBDivide(ByVal i As Long)
- Dim ST As Long, ET As Long, tempvar As Long
- ST = timeGetTime()
- For n = 0 To i
- tempvar = 31 / 8
- Next n
- ET = timeGetTime
- MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
- Label2.Caption = "Time taken: " & CStr((ET - ST) / 1000)
- End Sub
- Private Sub BSDivide(ByVal i As Long)
- Dim ST As Long, ET As Long, tempvar As Long
- ST = timeGetTime()
- For n = 0 To i
- tempvar = BSR(31, 4)
- Next n
- ET = timeGetTime
- MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
- Label3.Caption = "Time taken: " & CStr((ET - ST) / 1000)
- End Sub
- Private Sub VBMultiply(ByVal i As Long)
- Dim ST As Long, ET As Long, tempvar As Long
- ST = timeGetTime()
- For n = 0 To i
- tempvar = 9 * 8
- Next n
- ET = timeGetTime
- MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
- Label4.Caption = "Time taken: " & CStr((ET - ST) / 1000)
- End Sub
- Private Sub BSMultiply(ByVal i As Long)
- Dim ST As Long, ET As Long, tempvar As Long
- ST = timeGetTime()
- For n = 0 To i
- tempvar = BSL(9, 4)
- Next n
- ET = timeGetTime
- MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
- Label5.Caption = "Time taken: " & CStr((ET - ST) / 1000)
- End Sub
-