- Joined
- Dec 12, 2010
- Messages
- 2,074
Edit:
Fuck this, wc3 has no solid base for any measurments. Turned out un-looped non-random access to array 10x times faster than access to hashtable. code provided by
results:
Minding that that been 5k operations and yet it took <10 ms, it barely matters in real life, but it does matter for every snowflake.
Conclusion: hashtable is slower. but noone will ever notice that.
Fucking tired of that
PerfCounter - self-made mix with win-timer clock
5k calls for value, only 2x diff between an array access time and hashtable access time.
which means less than 8 mcs per loop for hash and 4.24 ms per loop for array
Stop. Using. This. Argument. Your HDD is slower than hash. Theres totally no reason to avoid hashtables.
Note: been tested with disabled OP limit, else it kills the thread due to 30k limit
Fuck this, wc3 has no solid base for any measurments. Turned out un-looped non-random access to array 10x times faster than access to hashtable. code provided by
Attached.
results:



Minding that that been 5k operations and yet it took <10 ms, it barely matters in real life, but it does matter for every snowflake.
Conclusion: hashtable is slower. but noone will ever notice that.
Fucking tired of that
JASS:
function HashvsArray takes nothing returns nothing
local integer i=1
local integer key1='cnst'
local integer key2
local integer array ar
set i=1
loop
set key2=GetRandomInt(1,8000)
call SaveInteger(HY,key1,key2,23)
set ar[key2]=23
set i=i+1
exitwhen i>5000
endloop
set i=1
call StartPerfCounter()
loop
set key2=GetRandomInt(1,8000)
set key2=LoadInteger(HY,key1,key2)
set i=i+1
exitwhen i>5000
endloop
call StopPerfCounter()
set i=1
call StartPerfCounter()
loop
set key2=GetRandomInt(1,8000)
set key2=ar[key2]
set i=i+1
exitwhen i>5000
endloop
call StopPerfCounter()
endfunction




5k calls for value, only 2x diff between an array access time and hashtable access time.
which means less than 8 mcs per loop for hash and 4.24 ms per loop for array
Stop. Using. This. Argument. Your HDD is slower than hash. Theres totally no reason to avoid hashtables.
Note: been tested with disabled OP limit, else it kills the thread due to 30k limit
Last edited: