Romek
Super Moderator
- Reaction score
- 963
Could you upload your benchmarking script/map?
Also, what are those benchmarks for? Start/Add, GetData, etc?
Also, what are those benchmarks for? Start/Add, GetData, etc?
This means only one TriggerEvaluate per procurement of a period. :nuts: Kind of a O(1) complexity loop (kind of).
It's many less TriggerEvaluates. You can see why this system is faster.
Captain Griffen prooved Rapid Timers is faster than TT
>So I can only presume you tested some "special cases"So I guess now we know the measure of your personal bias - 0.5%
private function KeyTimerLoop takes nothing returns nothing
set t_id=R2I(TimerGetTimeout(GetExpiredTimer())*800)
set t_mem=KeyTimerListEndPointer[t_id]
call TriggerEvaluate(TimerTrigger[t_id])
set t_mem=0
loop
exitwhen t_mem==AddRemoveMax
set t_mem=t_mem+1
if IsAdd[t_mem] then
set TriggerCond[ToAddMem[t_mem]]=TriggerAddCondition(TimerTrigger[t_id],Boolexpr[ToAddMem[t_mem]])
else
call TriggerRemoveCondition(TimerTrigger[t_id],ToRemove[t_mem])
call DestroyBoolExpr(ToDestroy[t_mem])
endif
endloop
set AddRemoveMax=0
set t_id=-1
endfunction
private function HF_Handler takes nothing returns nothing
local trigger swap
local integer i = HF_Counter
loop
exitwhen i<=0
set Data = HF_Dataz<i>
if TriggerEvaluate(HF_Triggz<i>) then
set swap = HF_Triggz<i>
call TriggerClearConditions(swap)
set HF_Triggz<i> = HF_Triggz[HF_Counter]
set HF_Triggz[HF_Counter] = swap
set HF_Dataz<i> = HF_Dataz[HF_Counter]
set HF_Counter = HF_Counter - 1
endif
set i = i - 1
endloop
// who can guess why am I not nulling swap here?
endfunction</i></i></i></i></i>
set t_id=R2I(TimerGetTimeout(GetExpiredTimer())*800)
set t_mem=KeyTimerListEndPointer[t_id]
call TriggerEvaluate(TimerTrigger[t_id])
set t_mem=0
...
set t_id=-1
set TriggerCond[a_mem]=TriggerAddCondition(TimerTrigger[a_id],Boolexpr[a_mem])
set TriggerCond[a_mem]=TriggerAddCondition(Trig,Boolexpr[a_mem])
Daxtreme said:Note by Daxtreme - Message to users replying in this thread: Please DO NOT reduce this thread into any kind of flamewar over benchtests. Thanks.
First of all TT is not slow, second I am not freaking out but simply find it hard to believe in sudden benchmark jumps out of nowhere.>The difference between TT and all other similars is that TT does not have insane Cons lists.
So stop freaking out at finding that it's slow. And that's also why you can't take this speed upgrade.
Err percantage is a relative category, number of instances has no effect on it.We both used very different methods, and found nearly the exact same percentage difference. He said 30% for 200 instances, I said 15% for 100 instances.
Anyway, I might benchmark these later, not for the reputation, but to end this debate.
Amazing how this benchmark results jump up and down.Well, I tested it too, with your maps.
I got:
TT: ~650
KT: ~780
So KT is faster. I'm not sure about the 50% faster though.
//========================================================================
// Make sure to set TT period constant for this test
// public constant real PERIOD = 0.04
//========================================================================
scope TTBenchmark initializer Test
globals
integer Count=0
real Last
real Sum=0.0
endglobals
private struct Data
integer ticks
lightning light
real x
real y
static method create takes nothing returns Data
local Data data = Data.allocate()
set data.ticks = R2I(10.0 / 0.04) // 10 seconds or 250 ticks
set data.x = GetRandomReal(-1024.0 , 1024.0)
set data.y = GetRandomReal(-1024.0 , 1024.0)
set data.light = AddLightning("CLPB", true, 0, 0, data.x, data.y)
return data
endmethod
method Tick takes nothing returns boolean
set .x = .x + GetRandomReal(-64.0 , 64.0)
set .y = .y + GetRandomReal(-64.0 , 64.0)
call MoveLightning(.light, false, 0, 0, .x, .y)
set .ticks = .ticks - 1
return .ticks <= 0
endmethod
method onDestroy takes nothing returns nothing
call DestroyLightning(.light)
endmethod
endstruct
//==================================================================================
// Generated functions
//==================================================================================
function DoExample0 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample1 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample2 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample3 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample4 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample5 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample6 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample7 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample8 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample9 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
//========================================================================
private function Test takes nothing returns nothing
local integer i = 10
loop
set i = i - 1
exitwhen i < 0
call TT_Start(function DoExample0, Data.create())
call TT_Start(function DoExample1, Data.create())
call TT_Start(function DoExample2, Data.create())
call TT_Start(function DoExample3, Data.create())
call TT_Start(function DoExample4, Data.create())
call TT_Start(function DoExample5, Data.create())
call TT_Start(function DoExample6, Data.create())
call TT_Start(function DoExample7, Data.create())
call TT_Start(function DoExample8, Data.create())
call TT_Start(function DoExample9, Data.create())
endloop
endfunction
endscope
scope KT2Benchmark initializer Test
globals
integer Count=0
real Last
real Sum=0.0
endglobals
private struct Data
integer ticks
lightning light
real x
real y
static method create takes nothing returns Data
local Data data = Data.allocate()
set data.ticks = R2I(10.0 / 0.04) // 10 seconds or 250 ticks
set data.x = GetRandomReal(-1024.0 , 1024.0)
set data.y = GetRandomReal(-1024.0 , 1024.0)
set data.light = AddLightning("CLPB", true, 0, 0, data.x, data.y)
return data
endmethod
method Tick takes nothing returns boolean
set .x = .x + GetRandomReal(-64.0 , 64.0)
set .y = .y + GetRandomReal(-64.0 , 64.0)
call MoveLightning(.light, false, 0, 0, .x, .y)
set .ticks = .ticks - 1
return .ticks <= 0
endmethod
method onDestroy takes nothing returns nothing
call DestroyLightning(.light)
endmethod
endstruct
//==================================================================================
// Generated functions
//==================================================================================
function DoExample0 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample1 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample2 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample3 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample4 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample5 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample6 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample7 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample8 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample9 takes nothing returns boolean
local Data data = KT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
//========================================================================
private function Test takes nothing returns nothing
local integer i = 10
call KT_Init() // use initializer keyword perhaps?
loop
set i = i - 1
exitwhen i < 0
call KT_Add(function DoExample0, Data.create(), 0.04)
call KT_Add(function DoExample1, Data.create(), 0.04)
call KT_Add(function DoExample2, Data.create(), 0.04)
call KT_Add(function DoExample3, Data.create(), 0.04)
call KT_Add(function DoExample4, Data.create(), 0.04)
call KT_Add(function DoExample5, Data.create(), 0.04)
call KT_Add(function DoExample6, Data.create(), 0.04)
call KT_Add(function DoExample7, Data.create(), 0.04)
call KT_Add(function DoExample8, Data.create(), 0.04)
call KT_Add(function DoExample9, Data.create(), 0.04)
endloop
endfunction
endscope
//========================================================================
// Make sure to set TT preload constant for this test
// private constant integer PRELOAD = 102
//========================================================================
scope TTExBenchmark initializer Test
globals
integer Count=0
real Last
real Sum=0.0
endglobals
private struct Data
integer ticks
lightning light
real x
real y
static method create takes nothing returns Data
local Data data = Data.allocate()
set data.ticks = R2I(10.0 / 0.04) // 10 seconds or 250 ticks
set data.x = GetRandomReal(-1024.0 , 1024.0)
set data.y = GetRandomReal(-1024.0 , 1024.0)
set data.light = AddLightning("CLPB", true, 0, 0, data.x, data.y)
return data
endmethod
method Tick takes nothing returns boolean
set .x = .x + GetRandomReal(-64.0 , 64.0)
set .y = .y + GetRandomReal(-64.0 , 64.0)
call MoveLightning(.light, false, 0, 0, .x, .y)
set .ticks = .ticks - 1
return .ticks <= 0
endmethod
method onDestroy takes nothing returns nothing
call DestroyLightning(.light)
endmethod
endstruct
//==================================================================================
// Generated functions
//==================================================================================
function DoExample0 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample1 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample2 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample3 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample4 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample5 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample6 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample7 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample8 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
function DoExample9 takes nothing returns boolean
local Data data = TT_GetData()
if data.Tick() then
call data.destroy()
return true
endif
return false
endfunction
//========================================================================
private function Test takes nothing returns nothing
local integer i = 10
loop
set i = i - 1
exitwhen i < 0
call TT_StartEx(function DoExample0, Data.create(), 0.04)
call TT_StartEx(function DoExample1, Data.create(), 0.04)
call TT_StartEx(function DoExample2, Data.create(), 0.04)
call TT_StartEx(function DoExample3, Data.create(), 0.04)
call TT_StartEx(function DoExample4, Data.create(), 0.04)
call TT_StartEx(function DoExample5, Data.create(), 0.04)
call TT_StartEx(function DoExample6, Data.create(), 0.04)
call TT_StartEx(function DoExample7, Data.create(), 0.04)
call TT_StartEx(function DoExample8, Data.create(), 0.04)
call TT_StartEx(function DoExample9, Data.create(), 0.04)
endloop
endfunction
endscope
Didn't cross my mind. I made those test in text editor.You can't bench that because it uses TT_StartEx on a non 0.0 period
I wouldn't trust myself with it.I'm shouldn't because apparently you don't trust me anyway.
Once again, relative properties are not affected by absolute parameters.You may have noticed Romek's computer is a lot faster than mine.
Vexorian would bitchslap you for that.By the way, KT_Init() was a modification for the test (although unneccessary - my thought was to make sure it fires before the scope initializer XD). The real system does use an initializer.
Could you upload a map, Cohadar?