Skip to content

Commit 6b8c88f

Browse files
authored
fix(patch): Fix occasionally incorrect unit in some tables [2/4] (#329)
## Description Actually resolves #277. EDIT: or actually not sure if this solves the same issue. But solves an issue anyway. Examples: Incorrect label, saying "M" aka "Mega" (or I guess "Millions" also reads fine): <kbd> <img width="832" height="214" alt="Incorrect unit label M denoting Mega" src="https://github.com/user-attachments/assets/f8e7419f-994d-4893-a9c3-72954a4c78ce" /> </kbd> Correct label, saying "K" aka "Kilo": <kbd> <img width="822" height="191" alt="Correct unit label K denoting Kilo" src="https://github.com/user-attachments/assets/e1953acc-4489-4b24-a7e1-7a84a97e0bb2" /> </kbd> To be completely clear, both these images are 100% correct other than the first image mentioning "M" aka 10^6. Feel free to review on your own schedule. ## How Has This Been Tested? Manually in my PRs. ## Minimal checklist: - [x] I have performed a self-review of my own code - [ ] I have added `DocC` code-level documentation for any public interfaces exported by the package - [ ] I have added unit and/or integration tests that prove my fix is effective or that my feature works
1 parent 5c3a2ee commit 6b8c88f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Sources/Benchmark/BenchmarkResult.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ public struct BenchmarkResult: Codable, Comparable, Equatable {
493493
_ rhs: Int,
494494
_ percentile: Self.Percentile,
495495
_ thresholds: BenchmarkThresholds,
496-
_ scalingFactor: Statistics.Units,
497496
_ thresholdResults: inout ThresholdDeviations,
498497
_ name: String = "unknown name",
499498
_ target: String = "unknown target"
@@ -514,7 +513,7 @@ public struct BenchmarkResult: Codable, Comparable, Equatable {
514513
difference: Int(Statistics.roundToDecimalplaces(relativeDifference, 1)),
515514
differenceThreshold: Int(threshold),
516515
relative: true,
517-
units: scalingFactor
516+
units: Statistics.Units(timeUnits)
518517
)
519518
if relativeDifference > threshold {
520519
thresholdResults.regressions.append(deviation)
@@ -534,7 +533,7 @@ public struct BenchmarkResult: Codable, Comparable, Equatable {
534533
difference: normalize(absoluteDifference),
535534
differenceThreshold: normalize(threshold),
536535
relative: false,
537-
units: scalingFactor
536+
units: Statistics.Units(timeUnits)
538537
)
539538

540539
if absoluteDifference > threshold {
@@ -568,7 +567,6 @@ public struct BenchmarkResult: Codable, Comparable, Equatable {
568567
rhsPercentiles[percentile],
569568
Self.Percentile(rawValue: percentile)!,
570569
thresholds,
571-
lhs.statistics.units(),
572570
&thresholdResults,
573571
name,
574572
target
@@ -594,7 +592,6 @@ public struct BenchmarkResult: Codable, Comparable, Equatable {
594592
p90Threshold,
595593
.p90,
596594
thresholds,
597-
statistics.units(),
598595
&thresholdResults,
599596
name,
600597
target

0 commit comments

Comments
 (0)