Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix(perf-gate): map the fixture at one fixed path so context bytes are stable

KageBinary3a6d74e8d7bb
diff --git a/ix-cli/scripts/perf-gate.mjs b/ix-cli/scripts/perf-gate.mjs
index 65cbb787..5720cb1a 100644
--- a/ix-cli/scripts/perf-gate.mjs
+++ b/ix-cli/scripts/perf-gate.mjs
@@ -65,9 +65,23 @@ async function reset(base) {
if (!res.ok) throw new Error(`POST /v1/reset: ${res.status}`);
}
+/**
+ * Where every copy of the fixture is made: the same absolute path on every run
+ * and every machine whose temp directory is /tmp, CI included.
+ *
+ * Node ids are hashed from the workspace's absolute path (workspaceIdForPath),
+ * and context's fan-out follows the backend's order of a node's neighbours,
+ * which follows those ids. A fresh random directory per run therefore drew a
+ * different set of walk seeds each time, and `context` response bytes moved
+ * by tens of percent between identical runs of the same commit.
+ */
+const CHECKOUT_ROOT = join(tmpdir(), "ix-perf-gate-checkout");
+
/** A fresh copy of the fixture (same directory name) and an empty IX_HOME. */
-function checkout(fixture, scratch) {
- const root = mkdtempSync(join(scratch, "run-"));
+function checkout(fixture) {
+ const root = CHECKOUT_ROOT;
+ rmSync(root, { recursive: true, force: true });
+ mkdirSync(root, { recursive: true });
const dir = join(root, basename(fixture));
cpSync(fixture, dir, { recursive: true });
const ixHome = join(root, "ix-home");
@@ -140,7 +154,7 @@ async function main() {
let co = co0;
if (sc.fresh) {
await reset(base);
- co = checkout(fixture, scratch);
+ co = checkout(fixture);
}
sc.prepare?.(co, i);
const r = measure(base, co, sc.args(co), log);
@@ -162,13 +176,14 @@ async function main() {
// Then one mapped copy shared by every other scenario, in order.
await reset(base);
- const shared = checkout(fixture, scratch);
+ const shared = checkout(fixture);
const first = measure(base, shared, ["map", shared.dir, "--silent"], log);
if (first.status !== 0) throw new Error(`initial map failed (exit ${first.status}): ${first.stderr}`);
for (const sc of all.filter((s) => !s.fresh)) await measureRuns(sc, shared);
} finally {
await reset(base).catch(() => {});
rmSync(scratch, { recursive: true, force: true });
+ rmSync(CHECKOUT_ROOT, { recursive: true, force: true });
}
if (opts.out) writeFileSync(opts.out, JSON.stringify(results, null, 2) + "\n");
diff --git a/ix-cli/test/e2e/README.md b/ix-cli/test/e2e/README.md
index f81f1f3d..9ab3d89d 100644
--- a/ix-cli/test/e2e/README.md
+++ b/ix-cli/test/e2e/README.md
@@ -143,6 +143,13 @@ makes a command cheaper should lower its budget in the same PR (`--update`,
then commit the file), so the gain can't be lost again unnoticed. In CI it is a
step of job `e2e`, and its results are uploaded as `perf-results`.
+Every copy of the fixture is made at one fixed path
+(`$TMPDIR/ix-perf-gate-checkout/<fixture name>`). Node ids are hashed from the
+workspace's absolute path, and `context` picks its walk seeds in the backend's
+neighbour order, which follows those ids: from a random directory per run, its
+response bytes moved by tens of percent between runs of the same commit. Run
+one gate at a time per machine.
+
## Fixtures
`fixtures/polyglot/` has 23 files: Python with cross-file calls (`app/`),
diff --git a/ix-cli/test/perf/budgets.json b/ix-cli/test/perf/budgets.json
index e476781e..6e5dbc52 100644
--- a/ix-cli/test/perf/budgets.json
+++ b/ix-cli/test/perf/budgets.json
@@ -22,14 +22,14 @@
"wallMs": 14162
},
"context IxClient": {
- "requests": 110,
- "bytes": 5630913,
+ "requests": 106,
+ "bytes": 6221598,
"wallMs": 2214,
"tolerance": 1.25
},
"context --from-issue": {
- "requests": 115,
- "bytes": 2770336,
+ "requests": 118,
+ "bytes": 2959562,
"wallMs": 1356,
"tolerance": 1.25
},