How to speed up execution

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

How to speed up execution

Post by whynotregister » 08 Oct 2021, 04:18

ahk_h is awesome. The only downside is that the program runs a bit slower. Does anyone have a user who improves this and uses it?
It takes about 2 seconds to execute about 20,000 lines of script.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to speed up execution

Post by HotKeyIt » 08 Oct 2021, 04:29

Do you have an example code that runs slower?
Are you using SetBatchLines, -1

whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

Re: How to speed up execution

Post by whynotregister » 08 Oct 2021, 04:47

HotKeyIt wrote:
08 Oct 2021, 04:29
Do you have an example code that runs slower?
Are you using SetBatchLines, -1
Yes. It is already in use.

User avatar
jNizM
Posts: 3183
Joined: 30 Sep 2013, 01:33
Contact:

Re: How to speed up execution

Post by jNizM » 08 Oct 2021, 04:56

You would have to take measurements (with QueryPerformanceFrequency / QueryPerformanceCounter) at different places in the code and see where the slowest part is.

I did the same also in a code I used and I found out that the wmi part takes 80% of the speed from my whole code I used (e.g.)


Maybe HotKeyIt implements it (QPC - high-resolution time stamps) in the near future in his ahk_h (als buildin). If not, it is only 3 DllCalls for one measurement.
[AHK] v2.0.5 | [WIN] 11 Pro (Version 22H2) | [GitHub] Profile

whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

Re: How to speed up execution

Post by whynotregister » 08 Oct 2021, 05:01

jNizM wrote:
08 Oct 2021, 04:56
You would have to take measurements (with QueryPerformanceFrequency / QueryPerformanceCounter) at different places in the code and see where the slowest part is.

I did the same also in a code I used and I found out that the wmi part takes 80% of the speed from my whole code I used (e.g.)


Maybe HotKeyIt implements it (QPC / Stopwatch) in the near future in his ahk_h. If not, it is only 3 DllCalls for one measurement.

I'm not talking about script performance. It literally means the time when the program is completely loaded when the exe is executed.
ahk_h performance is great. :bravo:

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to speed up execution

Post by HotKeyIt » 08 Oct 2021, 05:37

So you mean until your Gui is displayed for example?
In that case try to whitelist the program in your Antivirus programm, because AHK_H is larger and additionally uses compression internally it takes longer to anlyze it.

whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

Re: How to speed up execution

Post by whynotregister » 08 Oct 2021, 05:47

HotKeyIt wrote:
08 Oct 2021, 05:37
So you mean until your Gui is displayed for example?
In that case try to whitelist the program in your Antivirus programm, because AHK_H is larger and additionally uses compression internally it takes longer to anlyze it.

Yes. But I dont use AV, Windows Defender.
Compile the script with msgbox 1 written 20,000 lines. And when run it takes about 2 sec to show the msgbox window.
I understand that the ahk_h version has to sacrifice some execution time to protect the script.

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to speed up execution

Post by HotKeyIt » 08 Oct 2021, 07:00

Same is for Windows Defender.
Did you use compression?

whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

Re: How to speed up execution

Post by whynotregister » 08 Oct 2021, 07:03

HotKeyIt wrote:
08 Oct 2021, 07:00
Same is for Windows Defender.
Did you use compression?

yes use compression option

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to speed up execution

Post by HotKeyIt » 08 Oct 2021, 07:47

That of course takes the time since it copresses additionally line by line.
Did you try to whitelist in Windows Defender, was it any faster afterwards?

whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

Re: How to speed up execution

Post by whynotregister » 08 Oct 2021, 09:57

I already disabled windows defender, so it doesn't seem to matter.
Would the execution speed improve if decrypt 2-3 lines at the same time instead of decrypting line by line? Could this method introduce a security flaw?

HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: How to speed up execution

Post by HotKeyIt » 08 Oct 2021, 10:10

whynotregister wrote:
08 Oct 2021, 09:57
Would the execution speed improve if decrypt 2-3 lines at the same time instead of decrypting line by line? Could this method introduce a security flaw?
Not much if you have 20.000 lines and yes it would.

guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: How to speed up execution

Post by guest3456 » 08 Oct 2021, 18:24

whynotregister wrote:
08 Oct 2021, 04:18
It takes about 2 seconds to execute about 20,000 lines of script.
i'm seeing similar results on startup of my compiled script, i think its because of the source code encryption, since it needs to be decrypted on startup


whynotregister
Posts: 147
Joined: 05 Nov 2016, 22:42

Re: How to speed up execution

Post by whynotregister » 09 Oct 2021, 02:08

guest3456 wrote:
08 Oct 2021, 18:24
whynotregister wrote:
08 Oct 2021, 04:18
It takes about 2 seconds to execute about 20,000 lines of script.
i'm seeing similar results on startup of my compiled script, i think its because of the source code encryption, since it needs to be decrypted on startup
Yes, thats right :D

Post Reply

Return to “AutoHotkey_H”