Created
June 28, 2011 17:05
-
-
Save gsherman/1051608 to your computer and use it in GitHub Desktop.
testing clearbasic performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub test() | |
#Const SPEEDY=1 | |
Const numberOfIterations as Long = 100000 | |
Const firstname as String = "Ann" | |
Dim startingDate as Date | |
Dim endingDate as Date | |
Dim loopCounter as Long | |
Dim br as New BulkRetrieve | |
Dim bs as New BulkSave | |
Dim contactList as List | |
Dim contactRecord as Record | |
startingDate = App.CurrentDate | |
Debug.Print "started at: " + CStr(startingDate) | |
Debug.Print "number of iterations: " + cstr(numberOfIterations) | |
#if SPEEDY = 1 Then | |
Debug.Print "Running in SPEEDY mode" | |
#Else | |
Debug.Print "Running in NON-SPEEDY mode" | |
#End If | |
For loopCounter = 1 to numberOfIterations | |
#if SPEEDY = 1 Then | |
Set br = New BulkRetrieve | |
Set bs = New BulkSave | |
#End If | |
br.SimpleQuery 0, "contact" | |
br.AppendFilter 0, "first_name", cbEqual, firstName | |
br.RetrieveRecords | |
Set contactList = br.getRecordList(0) | |
Set contactRecord = contactList.ItemByIndex(0) | |
contactRecord.SetField "salutation", "Mrs." | |
bs.UpdateRecord contactRecord | |
bs.Save | |
Next loopCounter | |
endingDate = App.CurrentDate | |
Debug.Print "ended at: " + CStr(endingDate) | |
Debug.Print "elapsed time (in seconds): " + cstr(datediff("s",startingDate, endingDate)) | |
Debug.Print "elapsed time (in minutes): " + cstr(datediff("n",startingDate, endingDate)) | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
100000 iterations
non-speedy mode: 607 seconds
speedy mode: 279 seconds