Skip to content

Commit 5fe091c

Browse files
author
Brian Vaughn
authored
Swap log with cbrt for commit bar height (#20952)
1 parent ca15606 commit 5fe091c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/react-devtools-shared/src/devtools/views/Profiler/SnapshotCommitListItem.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ function SnapshotCommitListItem({data: itemData, index, style}: Props) {
4040
const commitDuration = commitDurations[index];
4141
const commitTime = commitTimes[index];
4242

43-
// Use natural log for bar height.
43+
// Use natural cbrt for bar height.
4444
// This prevents one (or a few) outliers from squishing the majority of other commits.
4545
// So rather than e.g. _█_ we get something more like e.g. ▄█_
4646
const heightScale =
4747
Math.min(
4848
1,
49-
Math.max(0, Math.log(commitDuration) / Math.log(maxDuration)),
49+
Math.max(0, Math.cbrt(commitDuration) / Math.cbrt(maxDuration)),
5050
) || 0;
5151

5252
// Use a linear scale for color.
5353
// 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.
5555
const colorScale =
5656
Math.min(1, Math.max(0, commitDuration / maxDuration)) || 0;
5757

0 commit comments

Comments
 (0)