How to optimize the speed of a script as much as possible.

Helpful script writing tricks and HowTo's
swagfag
Posts: 4026
Joined: 11 Jan 2017, 17:59

Re: How to optimize the speed of a script as much as possible.

03 Dec 2019, 16:36

dude, just start a new help thread and go over ur issue there, code and everything
99% the root cause has nothing at all to do with optimizations, setbatchlines, cpu cores, percentages, multithreading
hellas
Posts: 1
Joined: 24 Jan 2020, 11:57

Re: How to optimize the speed of a script as much as possible.

24 Jan 2020, 17:27

Sam_ wrote:
29 Nov 2019, 15:34
mojobadshah wrote:
29 Nov 2019, 14:26
What is the specific mechanism I need to initiate through AHK to push CPU rate up to at least x2 or ~50% or even more than this ?
AHK is single threaded. Each instance of a running script will only ever use a single CPU core. You can SetBatchLines to -1 and change the process priority to above normal, but beyond that there isn't much you can do to force AHK to utilize more resources in order to run faster. If you haven't already, reading the Performance section of RegExReplace might be insightful.
Why not High process priority? why "Avobenormal" is the best option?
Sam_
Posts: 125
Joined: 20 Mar 2014, 20:24

Re: How to optimize the speed of a script as much as possible.

24 Jan 2020, 18:02

hellas wrote:
24 Jan 2020, 17:27
Sam_ wrote:
29 Nov 2019, 15:34
mojobadshah wrote:
29 Nov 2019, 14:26
What is the specific mechanism I need to initiate through AHK to push CPU rate up to at least x2 or ~50% or even more than this ?
AHK is single threaded. Each instance of a running script will only ever use a single CPU core. You can SetBatchLines to -1 and change the process priority to above normal, but beyond that there isn't much you can do to force AHK to utilize more resources in order to run faster. If you haven't already, reading the Performance section of RegExReplace might be insightful.
Why not High process priority? why "Avobenormal" is the best option?
SvenBent wrote:
26 Mar 2016, 14:34
May i put in a small warning against "Process, Priority, , H" especially for big CPU heavy scripts

Process, Priority, , H puts you priority in the group with keyboard input and network drivers. So any CPU heavy sections of the script is going to infuse lag on both KB and network.
However if you script does not have any CPU heavy.sections there is no real benefit from adjusting priory. may i instead suggest do do only "Process, Priority, , A" it will still keep you priority above any other running software but below network and keyboard. Since Windows priority model is blocking priority ( With a lot of exceptions) there is no difference from being in High vs Above, when all other software is in Normal anyway. ( aka multiple steps higher priority is just as good as one step higher)

in short: unless you have a very specific technically reason. use only "Process, Priority, , A" to increase script priority.

Return to “Tutorials”

Who is online

Users browsing this forum: No registered users and 5 guests