How to Measure a function speed? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
pv007
Posts: 93
Joined: 20 Jul 2020, 23:50

How to Measure a function speed?

Post by pv007 » 21 Jan 2022, 11:23

There's any other way to measure the speed of a function?

Code: Select all

SetBatchLines, -1

Time := (A_TickCount)

Loop, 10
   Foo()

Time := (A_TickCount - Time)/10
MsgBox Time: %Time%

Foo() {
  ; Function ...
}
Sometimes my function takes 0ms and sometimes 15ms.
I have already seen some scripts using a dllcall to QueryPerformance, whats it?

User avatar
boiler
Posts: 16925
Joined: 21 Dec 2014, 02:44

Re: How to Measure a function speed?  Topic is solved

Post by boiler » 21 Jan 2022, 11:29

It's a more accurate way of measuring elapsed time. Here is an example.

Post Reply

Return to “Ask for Help (v1)”