home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / theama_1 / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-08-05  |  7.3 KB  |  222 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    BackColor       =   &H00000000&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Binary Shifting Speed Test"
  6.    ClientHeight    =   3105
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   4680
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   3105
  14.    ScaleWidth      =   4680
  15.    StartUpPosition =   3  'Windows Default
  16.    Begin VB.CommandButton Command4 
  17.       Caption         =   "Binary shift"
  18.       Height          =   255
  19.       Left            =   2400
  20.       TabIndex        =   7
  21.       Top             =   2280
  22.       Width           =   2175
  23.    End
  24.    Begin VB.CommandButton Command3 
  25.       Caption         =   "VB multiply"
  26.       Height          =   255
  27.       Left            =   120
  28.       TabIndex        =   6
  29.       Top             =   2280
  30.       Width           =   2175
  31.    End
  32.    Begin VB.CommandButton Command2 
  33.       Caption         =   "Binary shift"
  34.       Height          =   255
  35.       Left            =   2400
  36.       TabIndex        =   3
  37.       Top             =   1440
  38.       Width           =   2175
  39.    End
  40.    Begin VB.CommandButton Command1 
  41.       Caption         =   "VB divide"
  42.       Height          =   255
  43.       Left            =   120
  44.       TabIndex        =   2
  45.       Top             =   1440
  46.       Width           =   2175
  47.    End
  48.    Begin VB.TextBox Text1 
  49.       Alignment       =   2  'Center
  50.       BackColor       =   &H00000000&
  51.       BorderStyle     =   0  'None
  52.       BeginProperty Font 
  53.          Name            =   "Comic Sans MS"
  54.          Size            =   12
  55.          Charset         =   0
  56.          Weight          =   400
  57.          Underline       =   0   'False
  58.          Italic          =   0   'False
  59.          Strikethrough   =   0   'False
  60.       EndProperty
  61.       ForeColor       =   &H00C00000&
  62.       Height          =   285
  63.       Left            =   120
  64.       TabIndex        =   0
  65.       Text            =   "1000000"
  66.       Top             =   600
  67.       Width           =   4455
  68.    End
  69.    Begin VB.Label Label5 
  70.       Alignment       =   2  'Center
  71.       BackColor       =   &H00000000&
  72.       BeginProperty Font 
  73.          Name            =   "Comic Sans MS"
  74.          Size            =   9.75
  75.          Charset         =   0
  76.          Weight          =   700
  77.          Underline       =   0   'False
  78.          Italic          =   0   'False
  79.          Strikethrough   =   0   'False
  80.       EndProperty
  81.       ForeColor       =   &H000000FF&
  82.       Height          =   375
  83.       Left            =   2400
  84.       TabIndex        =   9
  85.       Top             =   2640
  86.       Width           =   2175
  87.    End
  88.    Begin VB.Label Label4 
  89.       Alignment       =   2  'Center
  90.       BackColor       =   &H00000000&
  91.       BeginProperty Font 
  92.          Name            =   "Comic Sans MS"
  93.          Size            =   9.75
  94.          Charset         =   0
  95.          Weight          =   700
  96.          Underline       =   0   'False
  97.          Italic          =   0   'False
  98.          Strikethrough   =   0   'False
  99.       EndProperty
  100.       ForeColor       =   &H000000FF&
  101.       Height          =   375
  102.       Left            =   120
  103.       TabIndex        =   8
  104.       Top             =   2640
  105.       Width           =   2175
  106.    End
  107.    Begin VB.Label Label3 
  108.       Alignment       =   2  'Center
  109.       BackColor       =   &H00000000&
  110.       BeginProperty Font 
  111.          Name            =   "Comic Sans MS"
  112.          Size            =   9.75
  113.          Charset         =   0
  114.          Weight          =   700
  115.          Underline       =   0   'False
  116.          Italic          =   0   'False
  117.          Strikethrough   =   0   'False
  118.       EndProperty
  119.       ForeColor       =   &H000000FF&
  120.       Height          =   375
  121.       Left            =   2400
  122.       TabIndex        =   5
  123.       Top             =   1800
  124.       Width           =   2175
  125.    End
  126.    Begin VB.Label Label2 
  127.       Alignment       =   2  'Center
  128.       BackColor       =   &H00000000&
  129.       BeginProperty Font 
  130.          Name            =   "Comic Sans MS"
  131.          Size            =   9.75
  132.          Charset         =   0
  133.          Weight          =   700
  134.          Underline       =   0   'False
  135.          Italic          =   0   'False
  136.          Strikethrough   =   0   'False
  137.       EndProperty
  138.       ForeColor       =   &H000000FF&
  139.       Height          =   375
  140.       Left            =   120
  141.       TabIndex        =   4
  142.       Top             =   1800
  143.       Width           =   2175
  144.    End
  145.    Begin VB.Label Label1 
  146.       Alignment       =   2  'Center
  147.       BackColor       =   &H00000000&
  148.       Caption         =   "Number of iterations"
  149.       BeginProperty Font 
  150.          Name            =   "Comic Sans MS"
  151.          Size            =   15.75
  152.          Charset         =   0
  153.          Weight          =   400
  154.          Underline       =   0   'False
  155.          Italic          =   0   'False
  156.          Strikethrough   =   0   'False
  157.       EndProperty
  158.       ForeColor       =   &H000000FF&
  159.       Height          =   495
  160.       Left            =   120
  161.       TabIndex        =   1
  162.       Top             =   120
  163.       Width           =   4455
  164.    End
  165. Attribute VB_Name = "Form1"
  166. Attribute VB_GlobalNameSpace = False
  167. Attribute VB_Creatable = False
  168. Attribute VB_PredeclaredId = True
  169. Attribute VB_Exposed = False
  170. Private Sub Command1_Click()
  171.     If IsNumeric(Text1.Text) Then Call VBDivide(Text1.Text)
  172. End Sub
  173. Private Sub Command2_Click()
  174.     If IsNumeric(Text1.Text) Then Call BSDivide(Text1.Text)
  175. End Sub
  176. Private Sub Command3_Click()
  177.     If IsNumeric(Text1.Text) Then Call VBMultiply(Text1.Text)
  178. End Sub
  179. Private Sub Command4_Click()
  180.     If IsNumeric(Text1.Text) Then Call BSMultiply(Text1.Text)
  181. End Sub
  182. Private Sub VBDivide(ByVal i As Long)
  183.     Dim ST As Long, ET As Long, tempvar As Long
  184.     ST = timeGetTime()
  185.     For n = 0 To i
  186.         tempvar = 31 / 8
  187.     Next n
  188.     ET = timeGetTime
  189.     MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
  190.     Label2.Caption = "Time taken: " & CStr((ET - ST) / 1000)
  191. End Sub
  192. Private Sub BSDivide(ByVal i As Long)
  193.     Dim ST As Long, ET As Long, tempvar As Long
  194.     ST = timeGetTime()
  195.     For n = 0 To i
  196.         tempvar = BSR(31, 4)
  197.     Next n
  198.     ET = timeGetTime
  199.     MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
  200.     Label3.Caption = "Time taken: " & CStr((ET - ST) / 1000)
  201. End Sub
  202. Private Sub VBMultiply(ByVal i As Long)
  203.     Dim ST As Long, ET As Long, tempvar As Long
  204.     ST = timeGetTime()
  205.     For n = 0 To i
  206.         tempvar = 9 * 8
  207.     Next n
  208.     ET = timeGetTime
  209.     MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
  210.     Label4.Caption = "Time taken: " & CStr((ET - ST) / 1000)
  211. End Sub
  212. Private Sub BSMultiply(ByVal i As Long)
  213.     Dim ST As Long, ET As Long, tempvar As Long
  214.     ST = timeGetTime()
  215.     For n = 0 To i
  216.         tempvar = BSL(9, 4)
  217.     Next n
  218.     ET = timeGetTime
  219.     MsgBox "Time taken to do " & CStr(i) & " iterations was " & CStr((ET - ST) / 1000) & " seconds."
  220.     Label5.Caption = "Time taken: " & CStr((ET - ST) / 1000)
  221. End Sub
  222.