I've been profiling my arena bots for various characters with the purpose of making them faster, and have noticed that an insane amount of execution time has been spent inside WoWSpell.get_Cooldown.
Turns out, this property is nothing but a wrapper for a LUA call to get the cooldown duration, which explains why its execution time is so high. This came rather as a shock to me, as checking cooldowns is one of the main things your CustomClasses and whatever else must do:
30% of total execution inside one property, ouch. Of course, this is higher than a usual use case as the interrupt routine runs every tick.
By caching the expected cooldown expiration time, and then polling WoWSpell.Cooldown to update that time at a greater interval, you can increase the speed (reduce the execution time) of your bot significantly without sacrificing much in terms of accuracy:
That is with a 2 second interval on cooldown checking, plus a reset when the spell is used or the expected cd time elapses. This very generic advice of course goes for many things, but for such an important part of a bot such as cooldown checking I believe is worth mentioning on its own. Another strategy is to defer the cooldown checking and trying less expensive checks first.
Compare Stealthers() % in first and second pics. lol.
Using this optimization method I've managed to get the entire bot to run in under ~100ms at a maximum tick rate. Those are some damn fast reactions.
Turns out, this property is nothing but a wrapper for a LUA call to get the cooldown duration, which explains why its execution time is so high. This came rather as a shock to me, as checking cooldowns is one of the main things your CustomClasses and whatever else must do:

30% of total execution inside one property, ouch. Of course, this is higher than a usual use case as the interrupt routine runs every tick.
By caching the expected cooldown expiration time, and then polling WoWSpell.Cooldown to update that time at a greater interval, you can increase the speed (reduce the execution time) of your bot significantly without sacrificing much in terms of accuracy:

That is with a 2 second interval on cooldown checking, plus a reset when the spell is used or the expected cd time elapses. This very generic advice of course goes for many things, but for such an important part of a bot such as cooldown checking I believe is worth mentioning on its own. Another strategy is to defer the cooldown checking and trying less expensive checks first.
Compare Stealthers() % in first and second pics. lol.

Last edited: