Quick Speed Fact

Troll-Brain

You can change this now in User CP.
Reaction score
85
JASS:
globals
    integer array AA
    integer IA=0
    integer array AB
    integer IB=0
    integer IC=1
endglobals
function F1 takes nothing returns nothing
    set IA=IA+1
    set AA[IA]=IC
endfunction
function F2 takes nothing returns nothing
    set IB=IB+1
    set AB[IC]=IB
endfunction


It probably doesn't matter at all and should get the same result though.

@kingkingyyk3 : use more instances of the loop, and try to change the order of the tests.
 

Nestharus

o-o
Reaction score
84
From my experience, 2 arrays reads are virtually the same speed as one array read; however 2 hashtable reads are half speed as you'd expect.


Any theories?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
TimerUtils Blue Testing
90243388.jpg


JASS:
//StopWatchCreate
//StopWatchMark
//StopWatchDestroy
library Tests initializer init

globals
    private timer T = CreateTimer()
    private real T0 = 0
    private real T1 = 0
endglobals

private function Actions takes nothing returns nothing
    local integer i = 0
    local real t1
    local real t0
    local integer sw = StopWatchCreate()
    
    set t0 = StopWatchMark(sw)
    loop
    exitwhen i>=1000
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        call OldSetTimerData(T,i)
        set i = i + 1
    endloop
    set t1 = StopWatchMark(sw)
    set T0 = 100000 * (t1-t0)
    
    call TriggerSleepAction(.0)
    
    set i = 0
    set t0 = StopWatchMark(sw)
    loop
    exitwhen i>=1000
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        call NewSetTimerData(T,i)
        set i = i + 1
    endloop
    set t1 = StopWatchMark(sw)
    set T1 = 100000 * (t1-t0)
    
    call StopWatchDestroy(sw)
    call BJDebugMsg("Old TimerUtils speed : " + R2S(T0) + "  | New TimerUtils speed : " + R2S(T1))
endfunction

private function init takes nothing returns nothing
    local trigger trig = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(trig,Player(0),"set",true)
    call TriggerAddAction(trig,function Actions)
endfunction

endlibrary
 
General chit-chat
Help Users

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top