Skip to content

Commit 990f846

Browse files
committed
clean up
1 parent 0888c3b commit 990f846

2 files changed

Lines changed: 9 additions & 14 deletions

File tree

build/benchmark.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ jobs:
184184
node $(BENCH_SCRIPTS)/setupPipeline.js
185185
displayName: Setup pipeline
186186
name: setupPipeline
187+
env:
188+
TSGOFLAG: $(TSGOFLAG)
187189
188190
189191

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

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,12 @@ async function runPerf(options: CLIOpts) {
110110
const config: TSServerConfig =
111111
JSON.parse(await fs.promises.readFile(options.commands, { encoding: "utf-8" })).tsserverConfig;
112112
const solution = path.resolve(path.join(options.suite, config.solution));
113-
let lspServerPath = path.resolve(options.lsp);
113+
const lspServerPath = path.resolve(options.lsp);
114114
// Needed for excludedDirectories
115115
process.chdir(solution);
116116

117117
const serverArgs: string[] = ["--lsp", "--stdio"];
118118

119-
// If the server is a JS file, run it under Node.js
120-
if (path.extname(lspServerPath).toLowerCase() === ".js") {
121-
serverArgs.unshift(lspServerPath);
122-
lspServerPath = process.execPath;
123-
}
124-
125119
const serverProc = cp.spawn(lspServerPath, serverArgs, {
126120
stdio: ["pipe", "pipe", "ignore"],
127121
});
@@ -152,7 +146,7 @@ async function runPerf(options: CLIOpts) {
152146
throw new Error("--cpus only works on Linux");
153147
}
154148

155-
// Set CPU affinity after the server starts (same approach as measuretsserver.ts)
149+
// Set CPU affinity after the server starts (same as measuretsserver.ts)
156150
execFileSync("taskset", ["--all-tasks", "--cpu-list", "--pid", options.cpus, `${serverProc.pid}`]);
157151
}
158152

@@ -219,7 +213,7 @@ async function runPerf(options: CLIOpts) {
219213
const command = config.commands[i];
220214
if (command) {
221215
if (options.cpus) {
222-
// Sleeping between commands prevents high variance when constraining to a single core
216+
// Sleeping between commands prevents high variance when constrained to a single core
223217
await sleep(1000);
224218
}
225219
await runCommand(command, seq++);
@@ -308,13 +302,12 @@ async function runPerf(options: CLIOpts) {
308302
async function references(command: TSServerReferencesCommand, _seq: number): Promise<number> {
309303
const file = path.join(solution, command.args.file);
310304
const fileUri = filePathToUri(file);
311-
// tsserver uses 1-based line/offset; LSP uses 0-based line/character
312305
const start = performance.now();
313306
await connection.sendRequest(protocol.ReferencesRequest.method, {
314307
textDocument: { uri: fileUri },
315308
position: {
316-
line: command.args.line - 1,
317-
character: command.args.offset - 1,
309+
line: command.args.line,
310+
character: command.args.offset,
318311
},
319312
context: { includeDeclaration: true },
320313
} as protocol.ReferenceParams);
@@ -340,8 +333,8 @@ async function runPerf(options: CLIOpts) {
340333
{
341334
textDocument: { uri: fileUri },
342335
position: {
343-
line: command.args.line - 1,
344-
character: command.args.offset - 1,
336+
line: command.args.line,
337+
character: command.args.offset,
345338
},
346339
} as protocol.CompletionParams,
347340
);

0 commit comments

Comments
 (0)