MCPcopy Create free account
hub / github.com/ShipSecAI/studio / runInlineBenchmark

Function runInlineBenchmark

worker/scripts/benchmark-scheduler.ts:202–230  ·  view source on GitHub ↗
(
  definition: WorkflowDefinition,
  iterations: number,
  label: BenchmarkMode,
)

Source from the content-addressed store, hash-verified

200}
201
202async function runInlineBenchmark(
203 definition: WorkflowDefinition,
204 iterations: number,
205 label: BenchmarkMode,
206): Promise<BenchmarkResult> {
207 const durations: number[] = [];
208
209 for (let i = 0; i < iterations; i += 1) {
210 const runId = `${label}-inline-${randomUUID()}`;
211 const start = Date.now();
212
213 const result = await executeWorkflow(definition, {}, { runId });
214 if (!result.success) {
215 throw new Error(`Inline benchmark ${label} failed: ${result.error}`);
216 }
217
218 durations.push(Date.now() - start);
219 }
220
221 const averageMs = durations.reduce((sum, value) => sum + value, 0) / durations.length;
222
223 return {
224 engine: 'inline',
225 mode: label,
226 runs: iterations,
227 durations,
228 averageMs,
229 };
230}
231
232async function main() {
233 const iterations = Number.parseInt(process.env.BENCHMARK_ITERATIONS ?? '3', 10);

Callers 1

mainFunction · 0.85

Calls 2

executeWorkflowFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected