Skip to content

Instantly share code, notes, and snippets.

@gsherman
Created June 28, 2011 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gsherman/1051608 to your computer and use it in GitHub Desktop.
Save gsherman/1051608 to your computer and use it in GitHub Desktop.
testing clearbasic performance
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
@gsherman
Copy link
Author

100000 iterations
non-speedy mode: 607 seconds
speedy mode: 279 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment