Renendaru
(Evol)ution is nothing without love.
- Reaction score
- 309
There ARE stopwatch natives, please look around before making assumptions. :O
globals
integer ii = GetRandomInt(-0x10000,0x10000)
endglobals
struct Data
integer array lol[100]
endstruct
function Trig_Test_Actions takes nothing returns nothing
local real result = 0
local integer sw = StopWatchCreate()
local integer i = 0
loop
exitwhen i == 1000
set Data(i).lol[0] = ii
set i = i + 1
endloop
set result = result + StopWatchMark(sw)
call BJDebugMsg(R2S(result))
call StopWatchDestroy(sw)
endfunction
globals
hashtable ht = InitHashtable()
integer ii = GetRandomInt(-0x10000,0x10000)
endglobals
function Trig_Test_Actions takes nothing returns nothing
local real result = 0
local integer sw = StopWatchCreate()
local integer i = 0
loop
exitwhen i == 1000
call SaveInteger(ht,i,0,ii)
set i = i + 1
endloop
set result = result + StopWatchMark(sw)
call BJDebugMsg(R2S(result))
call StopWatchDestroy(sw)
endfunction
Sounds correct to me. Anyone wanna guess why? :thup:F1 - .374
F2 - .334
library Classic initializer Init
globals
private gamecache gc
private hashtable ht
private integer array Data
endglobals
function StoreStruct takes handle whichHandle, integer whichStruct returns nothing
call StoreInteger(gc,I2S(GetHandleId(whichHandle)),"0",whichStruct)
endfunction
function GetStoredStruct takes handle whichHandle returns integer
return GetStoredInteger(gc,I2S(GetHandleId(whichHandle)),"0")
endfunction
function SaveStruct takes handle whichHandle, integer whichStruct returns nothing
call SaveInteger(ht,GetHandleId(whichHandle),0,whichStruct)
endfunction
function LoadStruct takes handle whichHandle returns integer
return LoadInteger(ht,GetHandleId(whichHandle),0)
endfunction
function AttachStruct takes handle whichHandle, integer whichStruct returns nothing
set Data[GetHandleId(whichHandle)-0x10000] = whichStruct
endfunction
function GetStruct takes handle whichHandle returns integer
return Data[GetHandleId(whichHandle)-0x10000]
endfunction
private function Init takes nothing returns nothing
call FlushGameCache(InitGameCache("=)"))
set gc = InitGameCache("=)")
set ht = InitHashtable()
endfunction
endlibrary
loop
exitwhen i == 1000
set Data(i).lol[0] = ii
set i = i + 1
endloop
Is it a joke ?Jesus4Lyf said:Sounds correct to me. Anyone wanna guess why?
//StopWatchCreate
//StopWatchMark
//StopWatchDestroy
library Tests initializer init
private struct Data[8]
integer array omg [1001]
endstruct
globals
private hashtable ht = InitHashtable()
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
set Data(1).omg<i> = i
set Data(2).omg<i> = i
set Data(3).omg<i> = i
set Data(4).omg<i> = i
set Data(5).omg<i> = i
set Data(6).omg<i> = i
set Data(7).omg<i> = i
set Data(8).omg<i> = i
set Data(1).omg<i> = i
set Data(2).omg<i> = i
set i = i + 1
endloop
set t1 = StopWatchMark(sw)
set T0 = 100000000 * (t1-t0)
call TriggerSleepAction(.0)
set i = 0
set t0 = StopWatchMark(sw)
loop
exitwhen i>=1000
call SaveInteger(ht,1,i,i)
call SaveInteger(ht,2,i,i)
call SaveInteger(ht,3,i,i)
call SaveInteger(ht,4,i,i)
call SaveInteger(ht,5,i,i)
call SaveInteger(ht,6,i,i)
call SaveInteger(ht,7,i,i)
call SaveInteger(ht,8,i,i)
call SaveInteger(ht,1,i,i)
call SaveInteger(ht,2,i,i)
set i = i + 1
endloop
set t1 = StopWatchMark(sw)
set T1 = 100000000 * (t1-t0)
call StopWatchDestroy(sw)
call BJDebugMsg("Struct array speed : " + R2S(T0) + " | Hashtable 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
</i></i></i></i></i></i></i></i></i></i>
Lol, it is not constant...