(i)
| 68 | }, 50); |
| 69 | |
| 70 | function runOne(i) { |
| 71 | const q = QUERIES[i % QUERIES.length]; |
| 72 | const startedAt = performance.now(); |
| 73 | let timer; |
| 74 | const timeout = new Promise((res) => { |
| 75 | timer = setTimeout(() => res({ timedOut: true }), TIMEOUT_MS); |
| 76 | }); |
| 77 | const work = handler |
| 78 | .execute('codegraph_explore', { query: q }) |
| 79 | .then((r) => ({ ok: !r.isError, chars: r.content?.[0]?.text?.length ?? 0 })) |
| 80 | .catch((e) => ({ ok: false, err: String(e?.message ?? e) })); |
| 81 | return Promise.race([work, timeout]).then((r) => { |
| 82 | clearTimeout(timer); |
| 83 | return { i, q, ms: Math.round(performance.now() - startedAt), ...r }; |
| 84 | }); |
| 85 | } |
| 86 | |
| 87 | // Baseline: one warm single call (so the first-call cold paths don't skew N). |
| 88 | const warmStart = performance.now(); |
no test coverage detected