firefox-devtools / firefox-devtools/profiler

For the SampleGraph, we should render on integer pixel values

Open
#3,237 1 comment 0 reactions 0 assignees View on GitHub
polish timeline
Dominant language
TypeScript
Stars
1.5k
Forks
491
Avg merge
3d 46m
Merged PRs (30d)
27

Description

Currently for the SampleGraph we reused some logic of the Stack Height Graph. While the logic might still make sense for that graph, it's not useful for the Sample Graph.

This is the logic to define the width: https://github.com/firefox-devtools/profiler/blob/4d18c1a99a5bfb9d04d04c39fe18bf22c9d18987/src/components/shared/thread/SampleGraph.js#L117-L123

It should be probably rounded (using the devicePixelRatio).

This is where the x position is computed:
https://github.com/firefox-devtools/profiler/blob/4d18c1a99a5bfb9d04d04c39fe18bf22c9d18987/src/components/shared/thread/SampleGraph.js#L155-L156

Simply rounding it isn't enough as we need to take the devicePixelRatio into account as well.

We also have a logic to draw only 4 samples per pixel: https://github.com/firefox-devtools/profiler/blob/4d18c1a99a5bfb9d04d04c39fe18bf22c9d18987/src/components/shared/thread/SampleGraph.js#L142-L144 But we should change it to draw only 1 sample per pixel.

┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-370)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.