<!--- Create a Test instance. ---> <cfset objTest = CreateObject( "component", "Test" ) /> <!--- Set the number of iterations we are going to use to test the invokation speeds. ---> <cfset intCount = 10000 /> <!--- We are going to start out by calling a method that does not exist. This will get ColdFusion to invoke the OnMissingMethod() event handler. Get the tick count before we start the test. ---> <cfset intStart = GetTickCount() /> <!--- Loop over the target number of iterations. ---> <cfloop index="intI" from="1" to="#intCount#" step="1"> <!--- Invoke the undefined method. ---> <cfset objTest.Blam() /> </cfloop> <!--- Output the time difference. ---> <p> Indirect: #(GetTickCount() - intStart)# Milliseconds </p> <!--- Now, we are going to compare that to the speed of calling the OnMissingMethod() function directly. Get the tick count before we start the test. ---> <cfset intStart = GetTickCount() /> <!--- Loop over the target number of iterations. ---> <cfloop index="intI" from="1" to="#intCount#" step="1"> <!--- Invoke the missing method function. ---> <cfset objTest.OnMissingMethod( MissingMethodName = "Blam", MissingMethodArguments = StructNew() ) /> </cfloop> <!--- Output the time difference. ---> <p> Direct: #(GetTickCount() - intStart)# Milliseconds </p>