GeezerVison is showing github.com — Swap log with cbrt for commit bar height (#20952) · koto/react@75d53ac
File tree
Expand file treeCollapse file tree
Open diff view settings
packages/react-devtools-shared/src/devtools/views/Profiler
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -40,18 +40,18 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) { |
40 | 40 | const commitDuration = commitDurations[index]; |
41 | 41 | const commitTime = commitTimes[index]; |
42 | 42 |
|
43 | | - // Use natural log for bar height. |
| 43 | + // Use natural cbrt for bar height. |
44 | 44 | // This prevents one (or a few) outliers from squishing the majority of other commits. |
45 | 45 | // So rather than e.g. _█_ we get something more like e.g. ▄█_ |
46 | 46 | const heightScale = |
47 | 47 | Math.min( |
48 | 48 | 1, |
49 | | - Math.max(0, Math.log(commitDuration) / Math.log(maxDuration)), |
| 49 | + Math.max(0, Math.cbrt(commitDuration) / Math.cbrt(maxDuration)), |
50 | 50 | ) || 0; |
51 | 51 |
|
52 | 52 | // Use a linear scale for color. |
53 | 53 | // This gives some visual contrast between cheaper and more expensive commits |
54 | | - // and somewhat compensates for the log scale height. |
| 54 | + // and somewhat compensates for the cbrt scale height. |
55 | 55 | const colorScale = |
56 | 56 | Math.min(1, Math.max(0, commitDuration / maxDuration)) || 0; |
57 | 57 |
|
|