-
Notifications
You must be signed in to change notification settings - Fork 791
ScriptableAutoSplit: Setting refreshRate leads to slower-than-expected update rates #2458
Copy link
Copy link
Open
Labels
area: ScriptableAutoSplitAffects the ScriptableAutoSplit component.Affects the ScriptableAutoSplit component.
Description
Setting refreshRate in the .asl does not lead to an actual refresh rate of the desired value, significantly at rates around 20-30 and 40-60 Hz. This is illustrated in the following graph

Notably, the jumps around 33 and 66 Hz correspond to decreases in the time intervals of approx 16 ms (~60 Hz). The measurements were produced by the following .asl:
state("LiveSplit") {}
startup
{
refreshRate = 34;
// Timer duration [s] * rate
vars.iterations = 2*refreshRate;
vars.i = 0;
}
update
{
if (vars.i == 0)
{
current.timeUpdates = Stopwatch.StartNew();
current.timeUpdates.Reset();
current.timeUpdates.Start();
}
if (vars.i>=vars.iterations)
{
vars.i = 0;
current.timeUpdates.Stop();
float elapsed = (float)current.timeUpdates.ElapsedMilliseconds;
print("__Average refresh rate__ : " + vars.iterations*1000/elapsed);
}
vars.i++;
}Note about the .asl: It's a bit weird that each instance prints the same value each nth update, but the value can vary when you reload the script.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: ScriptableAutoSplitAffects the ScriptableAutoSplit component.Affects the ScriptableAutoSplit component.