I have been out of circulation for a while but finally completed my ANSI vs UNICODE AHK benchmarker.
Conclusion:
1. Opening TDL, opening a tasklist and most of the sorting seems to be at the same speed (A vs U)
2. Sorting by due date seems to be much slower for Unicode, but is still pretty quick.
3. There does not seem to be a difference for TDLU in opening a unicode file or an ANSI file (the first opening time benchmark is an ANSI file)
4. Saving tasklists is much slower for Unicode than for ANSI
The code:
UPDATED:
Longer delays between sending keystrokes
Sorting combined and looped to create more accurate timing
Nicer output
;http:
xml=
(
<?xml version="1.0" encoding="windows-1252"?>
<TODOLIST FILENAME="" PROJECTNAME="" FILEFORMAT="9" NEXTUNIQUEID="1" LASTMODIFIED="2011-07-21" FILEVERSION="640" EARLIESTDUEDATE="40745.00000000">
</TODOLIST>
)
while PathToTDLA=""
FileSelectFile,PathToTDLA,1,,Please select the path to the ANSI TODOLIST.exe,*.exe
while PathToTDLU=""
FileSelectFile,PathToTDLU,1,,Please select the path to the Unicode TODOLIST.exe, *.exe
if WinExist("AbstractSpoon")
{
MsgBox, Please close all ToDoList windows before running the benchmark
exitapp
}
setTitlematchMode,2
run, %PathToTDLA%
winwait, AbstractSpoon
SendMessage, 0x111, 32853,,,AbstractSpoon ; close all tasklists = which creates a new tasklist as well
sleep,500
winclose, AbstractSpoon
WinWaitClose
run, %PathToTDLU%
winwait, AbstractSpoon
SendMessage, 0x111, 32853,,,AbstractSpoon ; close all tasklists = which creates a new tasklist as well
sleep,500
winclose, AbstractSpoon
WinWaitClose
NumTasks:=4500
StartTime:=A_TickCount
loop,1
{
Result1:=benchmark(PathToTDLA,NumTasks)
Result2:=benchmark(PathToTDLU,NumTasks)
result.= "Benchmark " . NumTasks . " tasks `tANSI `t`t`tUnicode `n" . Combine(result1,Result2)
;Result.=benchmark(PathToTDLU,NumTasks,"UniCode")
NumTasks*=2
}
Result.="Total time to run benchmarks:`t" . (A_TickCount- StartTime)/1000 . "`n"
ClipBoard:=Result
Msgbox, Results in clipboard. Please paste in TDL forum
BenchMark(TDLExe,Num)
{
Random, , 1234 ;consistent random number generation - now everyone uses the same tasklists
StartTime := A_TickCount
global xml
TDL:=loadXML(XML)
AddTasks(TDL,Num)
TDL.save(A_Temp . "\BenchMark.tdl")
Result=
;Result.= "Creating tasklist (Debug info - not official benchmark): `t" . (A_TickCount- StartTime)/1000 . "`n"
StartTime := A_TickCount
run, %TDLExe%
winwait, AbstractSpoon
Result.= "Opening TDL: `t`t`t" . (A_TickCount- StartTime)/1000 . "`n"
SendMessage, 0x111, 33238 ,,,AbstractSpoon ;Task Tree View
StartTime := A_TickCount
run, %TDLExe% %A_Temp%\BenchMark.tdl
winwait, BenchMark
Result.= "Opening TaskList: `t`t" . (A_TickCount- StartTime)/1000 . "`n"
SendMessage, 0x111, 32798,,,AbstractSpoon ;Create new task
sleep,500
send {Enter}
sleep,500
send {del} ; and delete
sleep,500
StartTime := A_TickCount
SendMessage, 0x111, 32816,,,AbstractSpoon ;Save
winwait, BenchMark%A_Space%-
Result.= "Saving TaskList: `t`t" . (A_TickCount- StartTime)/1000 . "`n"
SendMessage, 0x111, 33151 ,,,AbstractSpoon ;unsorted
StartTime := A_TickCount
loop,10
{ SendMessage, 0x111, 33131 ,,,AbstractSpoon ;Sort by title
SendMessage, 0x111, 33151 ,,,AbstractSpoon ;unsorted
SendMessage, 0x111, 33128 ,,,AbstractSpoon ;Due date
}
Result.= "Sorting (10 loops): `t" . (A_TickCount- StartTime)/1000 . "`n"
StartTime := A_TickCount
SendMessage, 0x111, 32853,,,AbstractSpoon ; close all tasklists = which creates a new tasklist as well
winwait (untitled
StartTime := A_TickCount
SendMessage, 0x111, 57616,,,AbstractSpoon ; opens most recent open tasklist
winwait, BenchMark
Result.= "Re-opening TaskList: `t" . (A_TickCount- StartTime)/1000 . "`n"
SendMessage, 0x111, 32798,,,AbstractSpoon ;Create new task
sleep,500
send {Enter}
sleep,500
send {del} ; and delete
sleep,500
StartTime := A_TickCount
SendMessage, 0x111, 32816,,,AbstractSpoon ;Save
winwait, BenchMark%A_Space%-
Result.= "Re-saving TaskList: `t" . (A_TickCount- StartTime)/1000 . "`n"
SendMessage, 0x111, 32853,,,AbstractSpoon ; close all tasklists = which creates a new tasklist as well
sleep,500
winclose, AbstractSpoon
WinWaitClose
result.="`n"
return result
}
return
AddTasks(TaskList,numtasks=1)
{
Loop,%numtasks%
{
Random, TaskTitle , 0, 2147483647
Random, DueDate, 40000, 41000
TDL_Add_TopLevel(TaskList,TaskTitle,DueDate)
}
}
TDL_Add_TopLevel(TaskList,Title,DueDate="")
{
NextID:=TaskList.childNodes.Item(1).getAttribute("NEXTUNIQUEID")
MyNode:=TaskList.createNode(1,"Task","")
MyNode.setattribute("Title",Title)
Mynode.setattribute("ID",NextID)
MyNode.setattribute("DueDate",DueDate)
MyNode.setattribute("Magic","Added by TDL Benchmark")
TaskList.childNodes.Item(1).appendChild(myNode)
TaskList.childNodes.Item(1).setAttribute("NEXTUNIQUEID",NextId+1)
}
loadXML(ByRef data)
{
o := ComObjCreate("MSXML2.DOMDocument.6.0")
o.async := false
o.loadXML(data)
return o
}
Combine(String1, String2)
{
result=
Loop,parse, String2,`n
S%A_Index%:=substr(A_LoopField,instr(A_LoopField,"`t",false,-0))
Loop,parse, String1,`n
result.=A_LoopField . "`t" . S%A_Index% . "`n"
return result
}
modified on Friday, July 22, 2011 3:01 AM
|