Just natives: 3.75s function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call StoreInteger(udg_cache,"10020003","a",GetStoredInteger(udg_cache,"10020003","a")) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction --------- Just function call: 5.28s function JustStore takes string a, string b, integer v returns nothing call StoreInteger(udg_cache,a,b,v) endfunction function JustGet takes string a, string b returns integer return GetStoredInteger(udg_cache,a,b) endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore("10020003","a",JustGet("10020003","a")) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction ------------ + I2S() 6.56s function JustStore takes integer a, string b, integer v returns nothing call StoreInteger(udg_cache,I2S(a),b,v) endfunction function JustGet takes integer a, string b returns integer return GetStoredInteger(udg_cache,I2S(a),b) endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore(10020003,"a",JustGet(10020003,"a")) set i=i-1 endloop endfunction --------------- + H2I() 7.34 s function H2I takes handle h returns integer return h return 0 endfunction function JustStore takes handle a, string b, integer v returns nothing call StoreInteger(udg_cache,I2S(H2I(a)),b,v) endfunction function JustGet takes handle a, string b returns integer return GetStoredInteger(udg_cache,I2S(H2I(a)),b) endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore(gg_trg_err,"a",JustGet(gg_trg_err,"a")) set i=i-1 endloop endfunction ----------------- + Autoflush : 6.50 s (seems like Flush faster than Store) function H2I takes handle h returns integer return h return 0 endfunction function JustStore takes handle a, string b, integer v returns nothing if (v==0) then call FlushStoredInteger(udg_cache,I2S(H2I(a)),b) else call StoreInteger(udg_cache,I2S(H2I(a)),b,v) endif endfunction function JustGet takes handle a, string b returns integer return GetStoredInteger(udg_cache,I2S(H2I(a)),b) endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore(gg_trg_err,"a",JustGet(gg_trg_err,"a")) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction ------------------------------- + Autoflush / make sure it is not 0 : 7.59 s function H2I takes handle h returns integer return h return 0 endfunction function JustStore takes handle a, string b, integer v returns nothing if (v==0) then call FlushStoredInteger(udg_cache,I2S(H2I(a)),b) else call StoreInteger(udg_cache,I2S(H2I(a)),b,v) endif endfunction function JustGet takes handle a, string b returns integer return GetStoredInteger(udg_cache,I2S(H2I(a)),b) endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore(gg_trg_err,"a",JustGet(gg_trg_err,"a")) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call JustStore(gg_trg_err,"a",65) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction ------------------------------------- - Store unit now 8.09s function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function JustStore takes handle a, string b, integer v returns nothing if (v==0) then call FlushStoredInteger(udg_cache,I2S(H2I(a)),b) else call StoreInteger(udg_cache,I2S(H2I(a)),b,v) endif endfunction function JustGet takes handle a, string b returns integer return GetStoredInteger(udg_cache,I2S(H2I(a)),b) endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore(gg_trg_err,"a",H2I( I2U( JustGet(gg_trg_err,"a")) ) ) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call JustStore(gg_trg_err,"a",H2I(gg_unit_Hmkg_0000)) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction -------------------------------------------------------- Store unit with wrappers 7.62 ** function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function JustStore takes handle a, string b, unit v returns nothing if (v==null) then call FlushStoredInteger(udg_cache,I2S(H2I(a)),b) else call StoreInteger(udg_cache,I2S(H2I(a)),b,H2I(v)) endif endfunction function JustGet takes handle a, string b returns unit return GetStoredInteger(udg_cache,I2S(H2I(a)),b) return null endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore(gg_trg_err,"a", JustGet(gg_trg_err,"a") ) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call JustStore(gg_trg_err,"a", gg_unit_Hmkg_0000 ) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction -------------------------- Use a function call and auto return bug but just natives: 5.56 s function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function JustStore takes string a, string b, unit v returns nothing call StoreInteger(udg_cache,a,b,H2I(v)) endfunction function JustGet takes string a, string b returns unit return GetStoredInteger(udg_cache,a,b) return null endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustStore("100003","a", JustGet("100003","a") ) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call JustStore("100003","a", gg_unit_Hmkg_0000 ) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction //=========================================================================== function InitTrig_err takes nothing returns nothing set udg_cache=InitGameCache("cscache") set gg_trg_err = CreateTrigger( ) call TriggerRegisterPlayerEventEndCinematic( gg_trg_err, Player(0) ) call TriggerAddAction( gg_trg_err, function A ) endfunction ---------------------------- natives + return bug completelly directly: 4.53 s function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call StoreInteger(udg_cache,"100003","a", H2I( I2U( GetStoredInteger(udg_cache,"100003","a" ) ) ) ) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call StoreInteger(udg_cache,"100003","a", H2I( gg_unit_Hmkg_0000 ) ) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction --------------------------------- just read directly 3.03 s function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call I2U( GetStoredInteger(udg_cache,"100003","a" ) ) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call StoreInteger(udg_cache,"100003","a", H2I( gg_unit_Hmkg_0000 ) ) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction //=========================================================================== function InitTrig_err takes nothing returns nothing set udg_cache=InitGameCache("cscache") set gg_trg_err = CreateTrigger( ) call TriggerRegisterPlayerEventEndCinematic( gg_trg_err, Player(0) ) call TriggerAddAction( gg_trg_err, function A ) endfunction ----------------------------- Just read, but use wrapper function with auto return bug 2.78 s ** function H2I takes handle h returns integer return h return 0 endfunction function I2U takes integer i returns unit return i return null endfunction function JustRead takes string a , string b returns unit return GetStoredInteger(udg_cache,a,b) return null endfunction function B takes nothing returns nothing local integer i=500 loop exitwhen (i==0) call JustRead("100003","a" ) set i=i-1 endloop endfunction function A takes nothing returns nothing local integer i=500 call StoreInteger(udg_cache,"100003","a", H2I( gg_unit_Hmkg_0000 ) ) loop exitwhen (i==0) call ExecuteFunc("B") set i=i-1 endloop call BJDebugMsg("!") endfunction //=========================================================================== function InitTrig_err takes nothing returns nothing set udg_cache=InitGameCache("cscache") set gg_trg_err = CreateTrigger( ) call TriggerRegisterPlayerEventEndCinematic( gg_trg_err, Player(0) ) call TriggerAddAction( gg_trg_err, function A ) endfunction --------------------- ** Probably measurement error, it kind of means that it is as fast and not faster than the alternative that seems faster and turns out it didn't.