This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

👷 Make timing job compare to main on PRs

+69 -11
+4 -2
.github/workflows/check.yml
··· 23 23 - uses: actions-rs/toolchain@v1 24 24 with: { toolchain: stable } 25 25 - uses: extractions/setup-just@v1 26 - - run: just timings 26 + - uses: carlosperate/download-file-action@v2 27 + with: { file-url: https://gwennlbh.github.io/shapemaker/timings.csv, file-name: results-main.csv } 28 + - run: just timings results-main.csv 27 29 - id: video 28 - uses: actions/upload-artifact 30 + uses: actions/upload-artifact@v4 29 31 with: 30 32 name: output-video 31 33 path: out.mp4
+2 -2
Justfile
··· 40 40 readme: 41 41 cd examples/gallery; ./fill.rb 42 42 43 - timings: 43 + timings compare_with="": 44 44 just 45 - python script/debug-performance.py 45 + python script/debug-performance.py {{compare_with}}
+63 -7
script/debug-performance.py
··· 1 1 import os 2 2 from pathlib import Path 3 3 from subprocess import run 4 + from sys import argv 4 5 from time import time_ns 5 6 6 7 from rich.console import Console ··· 8 9 9 10 ignored_tasks = [] 10 11 12 + compare_with = "" 13 + if len(argv) > 1: 14 + compare_with = Path(argv[1]).read_text(encoding="utf-8").strip() 15 + compare_with = { 16 + (line.split(",")[0], float(line.split(",")[1]), int(line.split(",")[2])) 17 + for line in compare_with.splitlines()[1:] 18 + } 19 + print(compare_with) 20 + 11 21 12 22 def avg(numbers: list[float]): 13 23 return sum(numbers) / len(numbers) 14 24 25 + end = 0 26 + start = 0 15 27 16 28 if not Path("timings.log").exists(): 17 29 start = time_ns() ··· 64 76 65 77 averages: list[tuple[str, float, int]] = [ 66 78 (function, avg(timings), len(timings)) for function, timings in per_function.items() 79 + ] + [ 80 + ("_Total_", (end - start) / 1e6, 1), 67 81 ] 68 82 69 83 averages.sort(key=lambda item: item[1]) 70 84 71 - formatted_results = [ 72 - [function, f"{timing:.3f}", f"{count}"] for function, timing, count in averages 73 - ] 85 + header = ["Tâche", "Durée [ms]", "#"] 74 86 75 - formatted_results += [ 76 - ["_Total_", f"{(end - start) / 1e6:.3f}", "1"], 77 - ] 87 + if compare_with: 88 + formatted_results = [] 89 + for function, timing_after, count_after in averages: 90 + if function not in {function for function, _, _ in compare_with}: 91 + continue 92 + timing_before = next( 93 + (timing for fn, timing, _ in compare_with if fn == function), 94 + None, 95 + ) 96 + count_before = next( 97 + (count for fn, _, count in compare_with if fn == function), 98 + None, 99 + ) 100 + if timing_before is None or count_before is None: 101 + continue 102 + if function in ignored_tasks: 103 + continue 104 + 105 + formatted_results.append( 106 + [ 107 + function, 108 + f"{timing_after:.3f}", 109 + f"{timing_before:.3f}", 110 + f"{timing_after - timing_before:+.3f}" 111 + if f"{timing_after - timing_before:.3f}" != "-0.000" 112 + else "±0", 113 + f"{count_after}", 114 + f"{count_before}", 115 + f"{count_after - count_before:+}" 116 + if count_after != count_before 117 + else "±0", 118 + ] 119 + ) 120 + 121 + header = [ 122 + "Tâche", 123 + "Durée [ms]", 124 + "Durée [ms] avant", 125 + "Différence [±ms]", 126 + "# après", 127 + "# avant", 128 + "Différence", 129 + ] 130 + else: 131 + formatted_results = [ 132 + [function, f"{timing:.3f}", f"{count}"] for function, timing, count in averages 133 + ] 78 134 79 135 80 136 def to_csv(lists: list[list[str]]): ··· 83 139 ) 84 140 85 141 86 - table = Table("task", "time [ms]", "count") 142 + table = Table(*header) 87 143 for row in formatted_results: 88 144 table.add_row(*row) 89 145 Console().print(table)