Macro Scheduler version 10.1.15 was released earlier this week. The number one item on the list of improvements states:
"- Optimized script variable handling to speed up script execution, especially when a script processes a large number of variables."
I would like to emphasize the importance of this nearly innocuous text blurb. I'm experiencing a 40X speed increase in a loop that concatenates variable values using version 10.1.15 compared to using 10.1.02. I have not stepped back in time to test the speed of processing variables in versions 7, 8 or 9 but I imagine the speed difference will be similar. Running the following test script using version 10.1.02 (using the script default 2500 loops) I get an average time of about 32.303 seconds to concatenate the 2500 variable values. Running this same script in version 10.1.15 averaged about 0.763 seconds to concatenate the same variable values. Dividing 32.303 by 0.763 would be 42.337 times faster under the new and improved version 10.1.15. (Yes this is all on the same computer....)
Different processes will probably experience different speed increases. For example, creating the variables to be processed was only 3 times faster. Even that is impressive. If someone took a car to the Bonneville Salt Flats and tripled the current land speed record, the world would take notice...
Here are my actual results:
Cycles --- Var_Create --- File_Create ----- Version -------- When
2500 -------- 0.531 -------- 0.75 -------------- 10.1.15 -------- 05/22/2008 07:11:43 PM
2500 -------- 0.5 ----------- 0.766 ------------ 10.1.15 -------- 05/22/2008 07:11:37 PM
2500 -------- 0.531 -------- 0.766 ------------ 10.1.15 -------- 05/22/2008 07:11:29 PM
2500 -------- 0.516 -------- 0.766 ------------ 10.1.15 -------- 05/22/2008 07:11:21 PM
2500 -------- 0.5 ----------- 0.766 ------------ 10.1.15 -------- 05/22/2008 07:11:11 PM
2500 -------- 1.5 ----------- 32.25 ------------ 10.1.02 -------- 05/22/2008 06:58:17 PM
2500 -------- 1.531 -------- 32.484 ----------- 10.1.02 -------- 05/22/2008 06:57:32 PM
2500 -------- 1.5 ----------- 32.188 ----------- 10.1.02 -------- 05/22/2008 06:56:39 PM
2500 -------- 1.5 ----------- 32.25 ------------- 10.1.02 -------- 05/22/2008 06:55:53 PM
2500 -------- 1.547 -------- 32.344 ------------ 10.1.02 -------- 05/22/2008 06:55:11 PM
Here is the script. The script creates the chart above. Test it yourself. Run the script using an earlier version of Macro Scheduler, then run the script using version 10.1.15. Be amazed.
Code: Select all
///////Variable initialization section
//////////////////////////////////////////
Let>msg_width=600
Let>kk=0
Let>kkk=0
Let>data=
Let>file=%temp_dir%\ConsecutiveNumbers.txt
IfFileExists>file
DeleteFile>file
EndIf
Let>Log=%temp_dir%\SpeedTestLog.txt
Let>LogBak=%temp_dir%\SpeedTestLog.bak
IfFileExists>Log
ReadFile>Log,LogData
Let>CF_OVERWRITE=1
CopyFile>Log,LogBak
DeleteFile>Log
Separate>LogData,When,LDVar
Let>LogEntry=%LDVar_1%When%CRLF%
Let>LogData=LDVar_2
Else
IfFileExists>LogBak
CopyFile>LogBak,Log
MDL>Log File does not exist. Reading from Log File Backup.
ReadFile>Log,LogData
DeleteFile>Log
Separate>LogData,When,LDVar
Let>LogEntry=%LDVar_1%When%CRLF%
Let>LogData=LDVar_2
Else
Let>LogEntry=Cycles%TAB%%TAB%Var_Create%TAB%File_Create%TAB%Version%TAB%%TAB%When%CRLF%
//WriteLn>Log,wres,LogEntry
Let>LogData=
EndIf
EndIf
///////End variable initialization section
//////////////////////////////////////////
///////Cycles input and validation section
//////////////////////////////////////////
Let>INPUT_BROWSE=0
Goto>Start
Label>ReTry
MDL>You typed "%qty%". Input MUST be numeric.
Label>Start
input>qty,number of loops,2500
If>qty=,EOF
VBSTART
'IsNumber Contributed by Marcus Tettmar Jan 19, 2007
Function IsNumber(var)
IsNumber = (LCase(var) = UCase(var)) and isNumeric(var)
End Function
Function IsInteger(var)
IsInteger = IsNumber(var) and (InStr(var,".") = 0)
End Function
VBEND
VBEval>IsNumber("%qty%"),IsNum
If>%IsNum%=False,ReTry
///End Cycles input and validation section
//////////////////////////////////////////
///////Test loop section
//////////////////////////////////////////
VBEval>timer,starttime
Repeat>kk
Add>kk,1
Let>var_%kk%=%kk%
Until>kk=qty
VBEval>timer,endtime
Let>Totaltime=%endtime%-%StartTime%
Let>TotalTime={(round(%TotalTime%*1000))/1000}
Message>Creating list of variables took %TotalTime% seconds
ConCat>LogEntry,%QTY%%TAB%%TAB%%TotalTime%%TAB%%TAB%
VBEval>timer,starttime
Repeat>kkk
Add>kkk,1
Let>value=var_%kkk%
ConCat>data,%value%%CRLF%
Until>kkk=qty
WriteLn>file,wres,data
VBEval>timer,endtime
Let>Totaltime=%endtime%-%StartTime%
Let>TotalTime={(round(%TotalTime%*1000))/1000}
GetDate>today
GetTime>now
ConCat>LogEntry,%TotalTime%%TAB%%TAB%%msched_ver%%TAB%%TAB%%today% %now%%LogData%
WriteLn>Log,wres,LogEntry
MessageModal>%LogEntry%
///////End test loop section
//////////////////////////////////////////
Label>EOF