profiler: Screenshot: stop repeating the same screenshot over and over when it doesn't change

In this patch we want to do an experiment, it’s not sure we’ll land this in the end. This experiment is that we don’t want that we repeat the screenshot in the screenshot track, if it doesn’t change.

The current logic is at https://github.com/firefox-devtools/profiler/blob/0ecc660cb4fc6877dff6cb8db08d08451453ff36/src/components/timeline/TrackScreenshots.js#L273-L333

What it does is that for each pixel we try to find the right screenshot. Especially here: https://github.com/firefox-devtools/profiler/blob/0ecc660cb4fc6877dff6cb8db08d08451453ff36/src/components/timeline/TrackScreenshots.js#L301-L307 We see that if don’t find a screenshot, by breaking we reuse the previous data.

We also see that there are 2 nested loops: the outer loop loops over the pixel “left” information, and the inner loops over the screenshots.

Instead I think we’ll want to invert the logic: the outer loop looping over the screenshots, and some logic inside to compute the “left” information. Especially take care that we don’t overlap images, so when looping over the screenshots you’ll need to skip them until we have some space. When finally we have some space we’ll need to display the last screenshot.

Maybe that’s not the easiest solution, and instead we should just change something at the break in the existing code. So this will need some research.

Here are some profile links containing screenshots:

┆Issue is synchronized with this Jira Task

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 15 (13 by maintainers)

Most upvoted comments

what exactly is the task is it to only show the screen shot and if it is not changing then we do not show it until the new screenshot has a change relative to previous one . do i got it wright or correct me if i am wrong . and what to show if the screenshot does not changes .

Yes, this is exactly this!

If the screenshot does not change, I believe this could just be “blank”, nothing drawn. We can decide later if we want to change the background to something grey instead of white, but that’s easy to do later.