From 7e5e78485590eb3a5e98436ef3c51d8fc8454046 Mon Sep 17 00:00:00 2001 From: Nader Al Awar Date: Wed, 1 Apr 2026 14:53:13 -0500 Subject: [PATCH 1/2] Add --markdown flag to nvbench_compare.py which can be use for github issues/prs --- python/scripts/nvbench_compare.py | 42 ++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/python/scripts/nvbench_compare.py b/python/scripts/nvbench_compare.py index 4b81d03..54a45a5 100644 --- a/python/scripts/nvbench_compare.py +++ b/python/scripts/nvbench_compare.py @@ -285,6 +285,7 @@ def compare_benches( dark, axis_filters, benchmark_filters, + markdown=False, ): if plot_along: import matplotlib.pyplot as plt @@ -452,19 +453,31 @@ def compare_benches( if not min_noise: unknown_count += 1 status_label = "????" - status = Fore.YELLOW + status_label + Fore.RESET + if markdown: + status = f"\U0001f7e1 {status_label}" + else: + status = f"{Fore.YELLOW}{status_label}{Fore.RESET}" elif abs(frac_diff) <= min_noise: pass_count += 1 status_label = "SAME" - status = Fore.BLUE + status_label + Fore.RESET + if markdown: + status = f"\U0001f535 {status_label}" + else: + status = f"{Fore.BLUE}{status_label}{Fore.RESET}" elif diff < 0: failure_count += 1 status_label = "FAST" - status = Fore.GREEN + status_label + Fore.RESET + if markdown: + status = f"\U0001f7e2 {status_label}" + else: + status = f"{Fore.GREEN}{status_label}{Fore.RESET}" else: failure_count += 1 status_label = "SLOW" - status = Fore.RED + status_label + Fore.RESET + if markdown: + status = f"\U0001f534 {status_label}" + else: + status = f"{Fore.RED}{status_label}{Fore.RESET}" if abs(frac_diff) >= threshold: row.append(format_duration(ref_time)) @@ -594,6 +607,13 @@ def main(): action="store_true", help="Use dark theme (black background, white text)", ) + parser.add_argument( + "--markdown", + dest="markdown", + default=False, + action="store_true", + help="Use emoji instead of ANSI color codes (useful for GitHub issues/PRs)", + ) parser.add_argument( "-a", "--axis", @@ -650,11 +670,14 @@ def main(): all_cmp_devices = cmp_root["devices"] if ref_root["devices"] != cmp_root["devices"]: - print( - (Fore.YELLOW if args.ignore_devices else Fore.RED) - + "Device sections do not match:" - + Fore.RESET - ) + if args.markdown: + print("Device sections do not match:") + else: + print( + (Fore.YELLOW if args.ignore_devices else Fore.RED) + + "Device sections do not match:" + + Fore.RESET + ) print( jsondiff.diff( ref_root["devices"], cmp_root["devices"], syntax="symmetric" @@ -672,6 +695,7 @@ def main(): args.dark, axis_filters, args.benchmark, + markdown=args.markdown, ) print("# Summary\n") From 7a68e53df08bcb05c6be014f7cffeea32a983e44 Mon Sep 17 00:00:00 2001 From: Nader Al Awar Date: Wed, 1 Apr 2026 17:01:29 -0500 Subject: [PATCH 2/2] Rename flag from markdown to no-color --- python/scripts/nvbench_compare.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/python/scripts/nvbench_compare.py b/python/scripts/nvbench_compare.py index 54a45a5..585cdde 100644 --- a/python/scripts/nvbench_compare.py +++ b/python/scripts/nvbench_compare.py @@ -285,7 +285,7 @@ def compare_benches( dark, axis_filters, benchmark_filters, - markdown=False, + no_color, ): if plot_along: import matplotlib.pyplot as plt @@ -453,28 +453,28 @@ def compare_benches( if not min_noise: unknown_count += 1 status_label = "????" - if markdown: + if no_color: status = f"\U0001f7e1 {status_label}" else: status = f"{Fore.YELLOW}{status_label}{Fore.RESET}" elif abs(frac_diff) <= min_noise: pass_count += 1 status_label = "SAME" - if markdown: + if no_color: status = f"\U0001f535 {status_label}" else: status = f"{Fore.BLUE}{status_label}{Fore.RESET}" elif diff < 0: failure_count += 1 status_label = "FAST" - if markdown: + if no_color: status = f"\U0001f7e2 {status_label}" else: status = f"{Fore.GREEN}{status_label}{Fore.RESET}" else: failure_count += 1 status_label = "SLOW" - if markdown: + if no_color: status = f"\U0001f534 {status_label}" else: status = f"{Fore.RED}{status_label}{Fore.RESET}" @@ -608,9 +608,8 @@ def main(): help="Use dark theme (black background, white text)", ) parser.add_argument( - "--markdown", - dest="markdown", - default=False, + "--no-color", + dest="no_color", action="store_true", help="Use emoji instead of ANSI color codes (useful for GitHub issues/PRs)", ) @@ -670,7 +669,7 @@ def main(): all_cmp_devices = cmp_root["devices"] if ref_root["devices"] != cmp_root["devices"]: - if args.markdown: + if args.no_color: print("Device sections do not match:") else: print( @@ -695,7 +694,7 @@ def main(): args.dark, axis_filters, args.benchmark, - markdown=args.markdown, + args.no_color, ) print("# Summary\n")