Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bastet Massri   on Oct 03 In MS Office Category.

  
Question Answered By: Aaleyah Khan   on Oct 03

I use this procedure to compare timings.

The important bits for youo are the call to GetTickCount and the line
calculating milliseconds.


Option Explicit
Declare Function GetTickCount Lib "kernel32" () As Long


Public Sub subCompareSpeed()
' Compare the speed of two procs.
' The overhead of the calls should not matter because
' this is a compare and not trying to measure absolutes.

' Add whatever but leave em here

Dim lnglCounter As Long
Dim lnglMax As Long
Dim lnglTime1 As Long
Dim lnglTime2 As Long
Dim lnglTime3 As Long
Dim strlLineA As String
Dim strlLine As String
Dim strlFirstItemsList As String
Dim blnFound As Boolean

lnglMax = 1000

MsgBox strlLineA
lnglCounter = 0
strlLine = strlLineA
lnglTime1 = GetTickCount()
Do
' subStripTextChrs strlLine
lnglCounter = lnglCounter + 1
Loop Until lnglCounter >= lnglMax
lnglTime2 = GetTickCount() - lnglTime1
MsgBox "Instr took " & lnglTime2 & " ms to finish'"
MsgBox strlLine
lnglCounter = 0
strlLine = strlLineA
lnglTime1 = GetTickCount()
Do
' subStripText strlLine
lnglCounter = lnglCounter + 1
Loop Until lnglCounter >= lnglMax
lnglTime2 = GetTickCount() - lnglTime1
MsgBox "Chrs took " & lnglTime2 & " ms to finish'"
MsgBox strlLine
MsgBox "Done"

End Sub

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Wait function and Invisible function Or get search suggestion and latest updates.


Tagged: