Skip to content

ScriptableAutoSplit: Setting refreshRate leads to slower-than-expected update rates #2458

@Gyoshi

Description

@Gyoshi

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
Refresh rate (1)
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions