@@ -311,9 +311,20 @@ def write_comparison(args, old_stats, new_stats):
311
311
312
312
if args .markdown :
313
313
314
+ def format_time (v ):
315
+ if abs (v ) > 1000000 :
316
+ return "{:.1f}s" .format (v / 1000000.0 )
317
+ elif abs (v ) > 1000 :
318
+ return "{:.1f}ms" .format (v / 1000.0 )
319
+ else :
320
+ return "{:.1f}us" .format (v )
321
+
314
322
def format_field (field , row ):
315
- if field == 'name' and args .group_by_module :
316
- return stat_name_minus_module (row .name )
323
+ if field == 'name' :
324
+ if args .group_by_module :
325
+ return stat_name_minus_module (row .name )
326
+ else :
327
+ return row .name
317
328
elif field == 'delta_pct' :
318
329
s = str (row .delta_pct ) + "%"
319
330
if args .github_emoji :
@@ -323,7 +334,11 @@ def format_field(field, row):
323
334
s += " :white_check_mark:"
324
335
return s
325
336
else :
326
- return str (vars (row )[field ])
337
+ v = int (vars (row )[field ])
338
+ if row .name .startswith ('time.' ):
339
+ return format_time (v )
340
+ else :
341
+ return "{:,d}" .format (v )
327
342
328
343
def format_table (elts ):
329
344
out = args .output
@@ -360,10 +375,12 @@ def keyfunc(e):
360
375
format_table (elts )
361
376
out .write ('</details>\n ' )
362
377
363
- format_details ('Regressed' , regressed , args .close_regressions )
378
+ closed_regressions = (args .close_regressions or len (regressed ) == 0 )
379
+ format_details ('Regressed' , regressed , closed_regressions )
364
380
format_details ('Improved' , improved , True )
365
- format_details ('Unchanged (abs(delta) < %s%% or %susec)' %
366
- (args .delta_pct_thresh , args .delta_usec_thresh ),
381
+ format_details ('Unchanged (delta < %s%% or delta < %s)' %
382
+ (args .delta_pct_thresh ,
383
+ format_time (args .delta_usec_thresh )),
367
384
unchanged , True )
368
385
369
386
else :
0 commit comments