| 105 | } |
| 106 | |
| 107 | function parseMetrics(output: string) { |
| 108 | const metrics = new Map<string, number>(); |
| 109 | const metricPattern = /^METRIC\s+([A-Za-z0-9_.:-]+)=(-?\d+(?:\.\d+)?)$/; |
| 110 | |
| 111 | for (const line of output.split(/\r?\n/)) { |
| 112 | const match = metricPattern.exec(line.trim()); |
| 113 | if (!match) { |
| 114 | continue; |
| 115 | } |
| 116 | |
| 117 | metrics.set(match[1]!, Number(match[2]!)); |
| 118 | } |
| 119 | |
| 120 | return metrics; |
| 121 | } |
| 122 | |
| 123 | async function runScript(script: string) { |
| 124 | const proc = Bun.spawn(["bun", "run", `benchmarks/${script}`], { |