Code: Select all
#NoEnv
SetBatchLines, -1
Process, Priority,, High
#Include Gdip_All.ahk
#Include Gdip_ImageSearch.ahk
gdipToken := Gdip_Startup()
START:=A_TickCount
Loop 1000000
{
A:=A_Index
Loop % 1000001-A
{
B:=A_Index+A
link:="G:\data\img" A ".png"
linkb:="G:\data\img" B ".png"
bmpHaystack := Gdip_CreateBitmapFromFile(link)
bmpNeedle := Gdip_CreateBitmapFromFile(linkb)
RET := Gdip_ImageSearch(bmpHaystack,bmpNeedle,LIST,0,0,0,0,4,0,1,1)
;OutputDebug % RET
Gdip_DisposeImage(bmpHaystack)
Gdip_DisposeImage(bmpNeedle)
If(RET>0){
Msgbox % A "," B
}
}
}
Gdip_Shutdown(gdipToken)
END:=A_TickCount
OutputDebug % "THREAR4:" END-START
return
I have a cpu intel core i7 4.8GHz 4core 8thread but I checked task manager, the script always use 14% cpu (86% idle). It does not work at full capacity because AHK not support multithread. So, I found AHK_H, I am a newbie, I don't have many experiments with AHK_H. I played with AHK_H 2 days but I don't know how to my script run with real multithreads.
Somebody can help me generate the script run with real multithread.
Thanks!