MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / main

Function main

scripts/bench/agent-control-benchmark.mjs:46–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 });
45
46async function main() {
47 assertBinary(simdeckBin, "Run npm run build:cli before benchmarking.");
48
49 const versions = {
50 simdeck: readVersion(simdeckBin, ["--version"]),
51 "agent-device": readVersion("agent-device", ["--version"]),
52 argent: readVersion("argent", ["--version"]),
53 };
54
55 const udid = options.udid || selectBootedIphoneUdid();
56 if (!udid) {
57 throw new Error(
58 "No booted iPhone simulator found. Boot one first or pass --udid <UDID>.",
59 );
60 }
61
62 const metadata = {
63 generatedAt: new Date().toISOString(),
64 udid,
65 reps: options.reps,
66 versions,
67 notes: [
68 "Cold rows stop tool services where practical before measuring the next first command.",
69 "Setup/reset work is excluded from action timings and uses xcrun/simdeck to normalize Settings state.",
70 "Argent has no selector tap/wait primitive in this comparison, so comparable navigation uses AX-derived coordinates.",
71 ],
72 };
73
74 console.log(`Benchmarking simulator ${udid}`);
75 console.log(
76 `Versions: simdeck ${versions.simdeck}, agent-device ${versions["agent-device"]}, argent ${versions.argent}`,
77 );
78
79 await benchmarkSimDeck(udid);
80 await benchmarkAgentDevice(udid);
81 await benchmarkArgent(udid);
82
83 const report = buildReport(metadata, rows);
84 const outDir =
85 options.outDir ||
86 path.join(tempRoot, new Date().toISOString().replace(/[:.]/g, "-"));
87 mkdirSync(outDir, { recursive: true });
88 const jsonPath = path.join(outDir, "agent-control-benchmark.json");
89 const markdownPath = path.join(outDir, "agent-control-benchmark.md");
90 writeFileSync(jsonPath, JSON.stringify({ metadata, rows }, null, 2));
91 writeFileSync(markdownPath, report);
92
93 console.log("");
94 console.log(report);
95 console.log("");
96 console.log(`Wrote ${jsonPath}`);
97 console.log(`Wrote ${markdownPath}`);
98}
99
100async function benchmarkSimDeck(udid) {
101 section("simdeck");

Callers 1

Calls 9

assertBinaryFunction · 0.85
readVersionFunction · 0.85
selectBootedIphoneUdidFunction · 0.85
benchmarkSimDeckFunction · 0.85
benchmarkAgentDeviceFunction · 0.85
benchmarkArgentFunction · 0.85
buildReportFunction · 0.85
logMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected