browserscripts/timings/rumSpeedIndex.js
function() {
      if (progress.length) {
        SpeedIndex = 0;
        var lastTime = 0;
        var lastProgress = 0;
        for (var i = 0; i < progress.length; i++) {
          var elapsed = progress[i].tm - lastTime;
          if (elapsed > 0 && lastProgress < 1)
            SpeedIndex += (1 - lastProgress) * elapsed;
          lastTime = progress[i].tm;
          lastProgress = progress[i].progress;
        }
      } else {
        SpeedIndex = firstPaint;
      }
    }
function() {
      if (progress.length) {
        SpeedIndex = 0;
        var lastTime = 0;
        var lastProgress = 0;
        for (var i = 0; i < progress.length; i++) {
          var elapsed = progress[i].tm - lastTime;
          if (elapsed > 0 && lastProgress < 1)
            SpeedIndex += (1 - lastProgress) * elapsed;
          lastTime = progress[i].tm;
          lastProgress = progress[i].progress;
        }
      } else {
        SpeedIndex = firstPaint;
      }
    }
function ( ) { if ( progress . length ) { SpeedIndex = 0 ; var lastTime = 0 ; var lastProgress = 0 ; for ( var i = 0 ; i < progress . length ; i ++ ) { var elapsed = progress [ i ] . tm - lastTime ; if ( elapsed > 0 && lastProgress < 1 ) SpeedIndex += ( 1 - lastProgress ) * elapsed ; lastTime = progress [ i ] . tm ; lastProgress = progress [ i ] . progress ; } } else { SpeedIndex = firstPaint ; } }
Given the visual progress information, Calculate the speed index.
Given the visual progress information Calculate the speed index .