Skip to content

Commit c974893

Browse files
committed
dont set --cpus when tsgo
1 parent e4fce58 commit c974893

3 files changed

Lines changed: 6 additions & 24 deletions

File tree

scripts/src/runTsPerf.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ async function getCommonBenchmarkArgs() {
6868
tsperfArgs.push("--scenario", scenario);
6969
tsperfArgs.push("--iterations", iterations);
7070
tsperfArgs.push("--warmups", warmups);
71-
tsperfArgs.push("--cpus", cpu);
71+
if (!process.env.TSGOFLAG) {
72+
// Don't set cpus/cores for tsgo
73+
tsperfArgs.push("--cpus", cpu);
74+
}
7275
if (predictable) {
7376
tsperfArgs.push("--predictable");
7477
}

ts-perf/packages/commands/src/benchmark/measure.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ async function runTSServerScenario(
317317
if (options.extended) {
318318
argsBuilder.add("--extended");
319319
}
320-
if (options.cpus) {
320+
if (options.cpus && !process.env.TSGOFLAG) {
321321
argsBuilder.add("--cpus", options.cpus);
322322
}
323323
if (options.predictable) {
@@ -417,7 +417,7 @@ async function runLSPScenario(
417417
if (options.extended) {
418418
argsBuilder.add("--extended");
419419
}
420-
if (options.cpus) {
420+
if (options.cpus && !process.env.TSGOFLAG) {
421421
argsBuilder.add("--cpus", options.cpus);
422422
}
423423
const { cmd, args } = argsBuilder;

ts-perf/packages/commands/src/benchmark/measurelsp.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ interface CLIOpts {
2929
commands: string;
3030
suite: string;
3131
extended?: boolean;
32-
cpus?: string;
3332
}
3433

3534
async function main() {
@@ -66,10 +65,6 @@ async function main() {
6665
type: "boolean",
6766
description: "If the scenario declares optional (aka extended) requests, run those as well",
6867
},
69-
cpus: {
70-
type: "string",
71-
description: "CPUs to run benchmarked processes on; see the --cpu-list in 'man taskset'",
72-
},
7368
},
7469
exec: ({ options }) => runPerf(options),
7570
});
@@ -138,18 +133,6 @@ async function runPerf(options: CLIOpts) {
138133
let seq = 1;
139134

140135
try {
141-
if (options.cpus) {
142-
if (!serverProc.pid) {
143-
throw new Error("--cpus specified, but server did not report PID");
144-
}
145-
if (process.platform !== "linux") {
146-
throw new Error("--cpus only works on Linux");
147-
}
148-
149-
// Set CPU affinity after the server starts (same as measuretsserver.ts)
150-
execFileSync("taskset", ["--all-tasks", "--cpu-list", "--pid", options.cpus, `${serverProc.pid}`]);
151-
}
152-
153136
// Initialize the LSP server (analogous to the configure message in tsserver)
154137
const solutionUri = filePathToUri(solution);
155138
await connection.sendRequest(protocol.InitializeRequest.method, {
@@ -212,10 +195,6 @@ async function runPerf(options: CLIOpts) {
212195
for (let i = 0; i < maxCommands; i++) {
213196
const command = config.commands[i];
214197
if (command) {
215-
if (options.cpus) {
216-
// Sleeping between commands prevents high variance when constrained to a single core
217-
await sleep(1000);
218-
}
219198
await runCommand(command, seq++);
220199
}
221200
}

0 commit comments

Comments
 (0)