Skip to content

Commit 2608d8a

Browse files
committed
host
1 parent 233a036 commit 2608d8a

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

scripts/src/runTsPerf.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ await fn();
2828

2929
async function installHosts() {
3030
const host = getNonEmptyEnv("TSPERF_JOB_HOST");
31+
if (host === "native") {
32+
console.log("Skipping host install for native binary");
33+
return;
34+
}
3135

3236
await $`node ${tsperfExe} host install --host ${host}`;
3337
}
@@ -59,7 +63,9 @@ async function getCommonBenchmarkArgs() {
5963
const cpu = getNonEmptyEnv("TSPERF_AGENT_BENCHMARK_CPU");
6064
const info = await getRepoInfo(args.builtDir);
6165

62-
tsperfArgs.push("--host", host);
66+
if (host !== "native") {
67+
tsperfArgs.push("--host", host);
68+
}
6369
tsperfArgs.push("--scenario", scenario);
6470
tsperfArgs.push("--iterations", iterations);
6571
tsperfArgs.push("--warmups", warmups);

scripts/src/setupPipeline.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const hosts = {
4949
node18: "node@18.15.0",
5050
bun: "bun@1.1.24",
5151
vscode: "vscode@1.82.1",
52+
native: "native", // Native Go binary; no host runtime needed.
5253
} as const satisfies Record<string, string>;
5354

5455
const allJobKinds = ["tsc", "tsserver", "startup"] as const;
@@ -389,7 +390,7 @@ async function parseInput({ input, isPr, gitParseRev }: SetupPipelineInput) {
389390
return parsed;
390391
}
391392

392-
function* transformPreset(parameters: Parameters, iter: Iterable<Scenario>): Iterable<Scenario> {
393+
function* transformPreset(parameters: Parameters, iter: Iterable<Scenario>, tsgo: boolean): Iterable<Scenario> {
393394
const all = [...worker()];
394395

395396
for (const scenario of all) {
@@ -410,9 +411,9 @@ function* transformPreset(parameters: Parameters, iter: Iterable<Scenario>): Ite
410411

411412
function* worker(): Iterable<Scenario> {
412413
for (const scenario of iter) {
413-
const hosts = parameters.hosts ?? [scenario.host];
414+
const scenarioHosts = tsgo ? [hosts.native] : (parameters.hosts ?? [scenario.host]);
414415

415-
for (const host of hosts) {
416+
for (const host of scenarioHosts) {
416417
yield {
417418
...scenario,
418419
host,
@@ -433,12 +434,13 @@ export interface SetupPipelineInput {
433434
input: string;
434435
baselining: boolean;
435436
isPr: boolean;
437+
tsgo: boolean;
436438
shouldLog: boolean;
437439
gitParseRev: (query: string) => Promise<GitParseRevResult>;
438440
}
439441

440442
export async function setupPipeline(input: SetupPipelineInput) {
441-
const { baselining, shouldLog } = input;
443+
const { baselining, shouldLog, tsgo } = input;
442444

443445
const parameters = await parseInput(input);
444446
if (shouldLog) {
@@ -470,7 +472,7 @@ export async function setupPipeline(input: SetupPipelineInput) {
470472
let maxCost = 0;
471473
const costPerAgent = new Map<Agent, number>();
472474

473-
for (const scenario of transformPreset(parameters, preset())) {
475+
for (const scenario of transformPreset(parameters, preset(), tsgo)) {
474476
const agent = baselining ? scenario.agent : "any";
475477
const jobName = sanitizeJobName(`${scenario.kind}_${scenario.host}_${scenario.name}`);
476478
matrix[agent][jobName] = {
@@ -591,11 +593,13 @@ if (esMain(import.meta)) {
591593
const input = getNonEmptyEnv("TSPERF_PRESET");
592594
const baselining = parseBoolean(process.env.USE_BASELINE_MACHINE, false);
593595
const isPr = parseBoolean(process.env.IS_PR, false);
596+
const tsgo = !!process.env.TSGOFLAG;
594597

595598
const { outputVariables } = await setupPipeline({
596599
input,
597600
baselining,
598601
isPr,
602+
tsgo,
599603
shouldLog: true,
600604
gitParseRev,
601605
});

0 commit comments

Comments
 (0)