#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Label1 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
End Sub
Sub Activity_Resume
Dim StartTime,EndTime As Long
'#################################################################
'Test 1
'#################################################################
Dim A(10) As Int = Array As Int(0,1,2,3,4,5,6,7,8,9)
Dim B(10) As Int
StartTime = DateTime.Now
For i = 0 To 10000
For j = 0 To A.Length -1
Select A(j)
Case 0
B(j) = B(j) + 1
Case 1
B(j) = B(j) + 1
Case 2
B(j) = B(j) + 1
Case 3
B(j) = B(j) + 1
Case 4
B(j) = B(j) + 1
Case 5
B(j) = B(j) + 1
Case 6
B(j) = B(j) + 1
Case 7
B(j) = B(j) + 1
Case 8
B(j) = B(j) + 1
Case 9
B(j) = B(j) + 1
End Select
Next
Next
EndTime = DateTime.Now
Label1.Text = "Test 1 Select Case : " & (EndTime - StartTime) & " ms"
'#################################################################
'Test 2
'#################################################################
Dim C(10) As Int = Array As Int(0,1,2,3,4,5,6,7,8,9)
Dim D(10) As Int
StartTime = DateTime.Now
For k = 0 To 10000
For l = 0 To C.Length -1
If l = 0 Then D(l) = D(l) + 1
If l = 1 Then D(l) = D(l) + 1
If l = 2 Then D(l) = D(l) + 1
If l = 3 Then D(l) = D(l) + 1
If l = 4 Then D(l) = D(l) + 1
If l = 5 Then D(l) = D(l) + 1
If l = 6 Then D(l) = D(l) + 1
If l = 7 Then D(l) = D(l) + 1
If l = 8 Then D(l) = D(l) + 1
If l = 9 Then D(l) = D(l) + 1
Next
Next
EndTime = DateTime.Now
Label1.Text = Label1.Text & CRLF & CRLF & "Test 2 Multiple If : " & (EndTime - StartTime) & " ms"
'#################################################################
'Test 3
'#################################################################
Dim E(10) As Int = Array As Int(0,1,2,3,4,5,6,7,8,9)
Dim F(10) As Int
StartTime = DateTime.Now
For m = 0 To 10000
For n = 0 To E.Length -1
If n = 0 Then
F(n) = F(n) + 1
Continue
End If
If n = 1 Then
F(n) = F(n) + 1
Continue
End If
If n = 2 Then
F(n) = F(n) + 1
Continue
End If
If n = 3 Then
F(n) = F(n) + 1
Continue
End If
If n = 4 Then
F(n) = F(n) + 1
Continue
End If
If n = 5 Then
F(n) = F(n) + 1
Continue
End If
If n = 6 Then
F(n) = F(n) + 1
Continue
End If
If n = 7 Then
F(n) = F(n) + 1
Continue
End If
If n = 8 Then
F(n) = F(n) + 1
Continue
End If
If n = 9 Then
F(n) = F(n) + 1
Continue
End If
Next
Next
EndTime = DateTime.Now
Label1.Text = Label1.Text & CRLF & CRLF & "Test 3 Multiple If & Continue : " & (EndTime - StartTime) & " ms"
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub