browsertime icon indicating copy to clipboard operation
browsertime copied to clipboard

ContentfulSpeedIndex (CSI) is currently problematic because it punishes staying on the last frame if the last frame is not the most contentful

Open mstange opened this issue 5 years ago • 3 comments

csi-score

The CSI algorithm implemented in visualmetrics.py currently does the following:

  1. For each frame, calculate a contentfulness score (based on edge detection and counting "edge" pixels).
  2. Find the maximum contentfulness across all frames.
  3. For each frame, calculate the percentage by which the frame differs from the maximum contentfulness.
  4. Add up the differences weighted by time.

This works ok if the last frame is the most contentful frame. However, if maximum contentfulness was reached before the final state, then the final state gets puninshed: The longer the video stays in the final state, the higher (worse) the score becomes, because it's not at its most contentful during that time. The duration of the final state in the captured videos is somewhat arbitrary. We rely somewhat on the assumption that some extra video seconds in the final state don't affect the score - but for CSI they do.

I have an example of a Fenix and a Chrome recording where Chrome puts content on the screen 200ms before Fenix. But the CSI score for Chrome is worse (higher), because it briefly shows some extra content (a gray line at the right edge of the viewport) that then goes away again, and this extra content punishes all remaining frames that don't have it.

Proposal: Rather than computing the maximum contentfulness, I think we should compare all frames to the "final" contentfulness. If a frame in the middle has more contentfulness than the final frame, then that frame should be treated as if it had the same contentfulness as the final frame. This rewards putting content on the screen early, and it doesn't punish staying in the final state longer.

mstange avatar Mar 26 '20 15:03 mstange

So there would be no penalty for having "too much" contentfulness (relative to final) during the pageload? Just to verify my understanding, not a real concern: Could one not render random high contentful graphics during pageload and then display the final image to "game" a higher CSI?

acreskeyMoz avatar Mar 26 '20 15:03 acreskeyMoz

I don't know if punishing "too much" contentfulness would be good or bad. We might want to experiment with both. Do we want to reward "any kind of content" on the screen or only "the right (amount of) content"? And yes, CSI is easily gameable just by putting noise on the screen earlier. I think the thinking behind CSI was that any kind of content is good to have on the screen early, even if it doesn't match the final content.

mstange avatar Mar 26 '20 16:03 mstange

What's the status here?

soulgalore avatar Dec 17 '23 05:12 soulgalore