Screenshot: stop repeating the same screenshot over and over when it doesn't change
See original GitHub issueIn 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 break
ing 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:
- https://profiler.firefox.com/public/404ff08ee5f412f355264601f12e5feff0ebaee6/marker-chart/?globalTrackOrder=6-1-2-3-4-0-5&thread=6&v=3
- https://profiler.firefox.com/public/d4e0b257c771dd7d4a7a6bd6c8c8cbb2d5dad40c/calltree/?globalTrackOrder=10-11-12-13-0-1-2-3-4-5-6-7-8-9&hiddenGlobalTracks=1-2-3-4-5-6-7-9&thread=9&v=3
- https://profiler.firefox.com/public/36d6d200bb8ec4eff5a90044dc066063703edf6a/calltree/?globalTrackOrder=4-5-0-1-2-3&hiddenGlobalTracks=1-2-3&thread=0&v=3
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (13 by maintainers)
Top GitHub Comments
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.
Hey @Bucky25, in this issue we don’t want to compare? So I don’t understand your question… Can you please explain this more?