float xfloat yfloat zmath.pow()math.pow()math.pow()
instead of this:
import mathfloat xfloat yfloat zx = Pow()y = pow()z = pow()
float xfloat yfloat zmath.pow()math.pow()math.pow()
import mathfloat xfloat yfloat zx = Pow()y = pow()z = pow()
While aiIteration < 1000 ; Time Elapsed: 0.012001 aiIteration += 1 fVar = Math.Pow(10, 23) EndWhile While aiIteration < 1000 ; Time Elapsed: 0.012001 aiIteration += 1 fVar = Pow(10, 23) EndWhileBoth while loops took the same amount of time to resolve.

While aiIteration < 1000 ; Time Elapsed: 0.012001 aiIteration += 1 fVar = Math.Pow(10, 23) EndWhile While aiIteration < 1000 ; Time Elapsed: 0.012001 aiIteration += 1 fVar = Pow(10, 23) EndWhileBoth while loops took the same amount of time to resolve.

It's actually really easy to run speed tests with Papyrus.Function SpeedTest(Int aiIteration = 0, Float afStart = 0.0, Float afFinish = 0.0) Debug.Notification("Test started...") afStart = GetCurrentRealTime() Debug.Trace("Start: " + afStart) While aiIteration < 1000 aiIteration += 1 EndWhile afFinish = GetCurrentRealTime() Debug.Trace("Finish: " + afFinish) Debug.Trace("Time elapsed: " + (afFinish - afStart)) Debug.Notification("Time elapsed: " + (afFinish - afStart))EndFunction


I'd actually been hoping you were planning on doing it, but am willing if you aren't planning on it.Function SpeedTest(Int aiIteration = 0, Float afStart = 0.0, Float afFinish = 0.0) Debug.Notification("Test started...") afStart = GetCurrentRealTime() Debug.Trace("Start: " + afStart) While aiIteration < 1000 aiIteration += 1 ; Code to test EndWhile afFinish = GetCurrentRealTime() Debug.Trace("Finish: " + afFinish) Debug.Trace("Time elapsed: " + (afFinish - afStart)) Debug.Notification("Time elapsed: " + (afFinish - afStart))EndFunctionref = cachedRef1.0 - simply copying a reference variable is pretty fast (although there are some things like just checking "if x > 3" that are even slightly faster.
GetReference()1.0 - Just calling the function without using the result (which obviously isn't very useful)
ref = GetReference()2.0 - obviously it's just the sum of assignment and function call results
GetRef()2.0 - it's a wrapper function which then calls GetReference() so that's two calls total and would be 3 if you then try to use it!
GetPlayer()
Game.GetPlayer()930.0 - with Game imported or without makes absolutely no difference


Test Case: 0 if 0 if n if !n ref=0x14/ActorCost/1000: -0.000073 0.002433 0.002467 0.005600 0.017034Cost/1000: 0.000100 0.002500 0.002500 0.005600 0.017600Cost/1000: -0.000093 0.002367 0.002267 0.005433 0.018533Cost/1000: 0.000033 0.002500 0.002434 0.005633 0.018467Cost/1000: 0.000100 0.002433 0.002367 0.004800 0.017767
Test Case: GetPlayer() GetReference() ref = me 0.04 as int Floor(0.04)Cost/1000: 20.773335 0.019167 0.002433 0.002500 0.009700Cost/1000: 21.303345 0.020267 0.002500 0.002333 0.009667Cost/1000: 20.960020 0.019933 0.002400 0.002400 0.009734Cost/1000: 21.179985 0.019533 0.002467 0.002267 0.009667Cost/1000: 21.439970 0.020033 0.002334 0.002433 0.009533
Test Case: GetDistance() get time if n == 0 if !n; n=5 n = 5Cost/1000: 21.783318 21.749992 0.005500 0.004833 0.002367Cost/1000: 21.246670 21.376659 0.004833 0.004900 0.002433Cost/1000: 21.926651 21.253384 0.005700 0.004734 0.002400Cost/1000: 21.450018 20.509975 0.006366 0.004867 0.002467Cost/1000: 21.423367 21.360014 0.005600 0.004767 0.002333
I've read of them, but hadn't yet delved into tinkering with those.
Three cheers for your brainchild
Papyrus is brain candy!int PowerAttack = attacker.getfactionrank(aadpPowerAttackFaction)
While aiIteration < 1000 aiIteration += 1 bVar = kFLST.HasForm(kARMO) ; Time elapsed: 14.004997 EndWhile
While aiIteration < 1000 aiIteration += 1 bVar = kARMO.HasKeyword(kKYWD) ; Time elapsed: 14.024998 EndWhile