@@ -120,12 +120,7 @@ def format_cell(val, std, rounds):
120120 if rounds < 2 or std == 0 :
121121 std_str = "± ∞"
122122 else :
123- # Calculate percentage or absolute? benchstat uses absolute if small, or %?
124- # benchstat: 8.768n ± ∞
125- # Let's try to show absolute or %?
126- # The input example shows "± ∞".
127- # If we have valid stddev, benchstat usually shows "± 2%" or similar if using -html?
128- # Text output of benchstat usually is "± 2%".
123+
129124 pct = (std / val ) * 100
130125 std_str = f"± { pct :.0f} %"
131126
@@ -142,38 +137,23 @@ def format_cell(val, std, rounds):
142137 pr_str = format_cell (pr_mean , pr_std , pr_rounds ) if pr else "N/A"
143138
144139 # Delta column (Statistical Significance)
145- # Without scipy, we can't do a real T-test easily.
146- # We will emulate the output format: "~ (p=1.000 n=1) ²"
147- # If n=1, p=1.000.
148- # If we assume no significant difference for now (safe default), we use "~".
140+
149141 delta_str = ""
150142 if base and pr :
151143 # Simple check: do intervals overlap?
152- # But let's just stick to the requested format with n count.
153- # "n=1" if rounds are different? usually min(n1, n2)?
144+
154145 n = min (base_rounds , pr_rounds )
155146
156147 # Mock p-value logic for display
157148 # If n < 4, benchstat says it can't detect difference usually?
158149 p_val = 1.000 # Placeholder
159150
160- # If we want to be fancy, we could try to implement Welchs t-test, but maybe overkill.
161- # Let's just output the n and p=?.
162- # User wants "Reference ... add superscripts ... and statistical indicators".
163- # The indicators in the example are "~ (p=1.000 n=1) ²".
164- # The footnote says: "² need >= 4 samples to detect a difference at alpha level 0.05"
165-
151+
166152 if n < 4 :
167153 delta_str = f"~ (p={ p_val :.3f} n={ n } ) ²"
168154 need_insignificant_note = True
169155 else :
170- # If we have enough samples, we should ideally show the % change and p-value.
171- # But since we are calculating % change in the NEXT step (benchmark_formatter),
172- # maybe we just output the p-value info here?
173- # Or we can output the simple delta here too?
174- # Let's stick to the "insufficient samples" warning style if n is low.
175- # If n is high, we might not output ² but we still need a p-value.
176- # Let's default to "~" (no diff) if we can't calculate p.
156+
177157 delta_str = f"~ (p=? n={ n } )"
178158
179159 display_name = normalize_name (name )
@@ -203,8 +183,7 @@ def format_cell(val, std, rounds):
203183 print ("¹ need >= 6 samples for confidence interval at level 0.95" )
204184 if need_insignificant_note :
205185 print ("² need >= 4 samples to detect a difference at alpha level 0.05" )
206- # if need_geomean_note:
207- # print("⁴ summaries must be >0 to compute geomean")
186+
208187
209188
210189if __name__ == "__main__" :
0 commit comments