• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Question about TimerUtils efficiency

Status
Not open for further replies.

Deleted member 219079

D

Deleted member 219079

I know some flavor of it uses hashtable to get past 8190 instances, but I hate how it'll use two native calls..

What's the method by default and what's the version which uses no hashtable calls to get timer data?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
map handle ids of timer to array, substracting the base(0x100000 which is 1,048,576) from the handleid.

This is even used by TimerUtils, with the "quick" flavour, but the problem is, if your map has >8191 handles, you are "le fucked". You can also use struct instances, that have the handle id stored, but then the retreive is O(log n) average, O(n) worst case
 
Just use Vexorian's TimerUtils (the one after update) or Maggies TimerUtilsEx (the same stuff). Both give you a choice between fast array or hash. Remember to increase max stack size since by default it's pretty low.
edo494 pretty much described every limitation, yet, you shouldn't really worry about these as long as you are not performing some hard core stuff that requires every bit/ms of efficiency.

After all, it's just jass environment, we are not writting applications or systems here.
 

Deleted member 219079

D

Deleted member 219079

map handle ids of timer to array, substracting the base(0x100000 which is 1,048,576) from the handleid.

This is even used by TimerUtils, with the "quick" flavour, but the problem is, if your map has >8191 handles, you are "le fucked". You can also use struct instances, that have the handle id stored, but then the retreive is O(log n) average, O(n) worst case
Would this work?
JASS:
local timer t = GetExpiredTimer()
local thistype this = GetTimerData(t)
into -->
JASS:
local timer t = GetExpiredTimer()
local thistype this = thistype[GetHandleId(t)-0x100000]

edit: oh sh*t that still has the same limit of 8191 timers :/ ah, seems like i need to use the hashtable version..
 
8191 handles, not timers :) GetHandleId(t)-0x100000 The handleid value that is assigned for each and every handle is unique and starts from 0x100000. Each new handle increases that value by 1, thus you can quickly by pass 8191 limit considering that "handle" is not only related to timers.

Thats why for bigger maps you probably want hash version.

Why would you need to run 8191 at the same time anyway?
 

Deleted member 219079

D

Deleted member 219079

Oh, it's not only timers :'( well crap. Thanks for the info anyway. Now I know that TimerUtils isn't as cool as I used to see it..

Thread is solved..
 
Status
Not open for further replies.
Top