HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is this function fast?

08-29-2009, 02:49 AM#1
TriggerHappy
Collapse JASS:
    function wtf takes timer t returns integer
        return R2I(((TimerGetTimeout(t)*100000)*10+.5))-1000000
    endfunction

I'd like to know if it's faster than H2I-Subtraction.

Also if R2I, TimerGetTimeout, and multiplications are slow.
08-29-2009, 02:58 AM#2
Bobo_The_Kodo
GetHandleId() and subtraction is probably more than twice as fast
08-29-2009, 03:00 AM#3
TriggerHappy
Quote:
GetHandleId() and subtraction is probably more than twice as fast

And what makes this function slower is what I would like to know.

R2I?
TimerGetTimeout?
Multiplications?
08-29-2009, 03:28 AM#4
Bobo_The_Kodo
more operations = slower .
also gethandleid is probably faster than r2i and timergettimeout as it has probably has less internal ops - handles are just pointers? - direct integer lookup
08-29-2009, 01:32 PM#5
Vulcano
(TimerGetTimeout(t)*100000)*10 == TimerGetTimeout(t)*1000000
thats a useless operation less
08-29-2009, 02:34 PM#6
DioD
use hashtable attaching not this shit.
08-30-2009, 01:21 AM#7
TriggerHappy
Quote:
Originally Posted by DioD
use hashtable attaching not this shit.

Was just an experiment.
08-30-2009, 05:32 PM#8
thehellman
What does TimerGetTimeout do?

So if you star ta timer that periodic occurs 0.03 times, TimerGetTimeout will return 0.03?

I'm asking because is there anyway to see how many times a timer has called the callback without the use of changing a variable?