summaryrefslogtreecommitdiff
path: root/cli/tsc/99_main_compiler.js
diff options
context:
space:
mode:
authorNathan Whitaker <17734409+nathanwhit@users.noreply.github.com>2024-04-19 10:11:17 -0700
committerGitHub <noreply@github.com>2024-04-19 10:11:17 -0700
commitb5ce9cda0dfaed4afcb85d71c2c49c82b2fe3401 (patch)
treed8bbfb54cb29976a1a40d7169e74b7533c52a037 /cli/tsc/99_main_compiler.js
parentf4b5eec52e01249b13d795010cd995113d9ef569 (diff)
perf(lsp): Avoid passing struct into op_resolve (#23452)
Going through serde_v8 is slow, so just pass the args separately. `op_resolve` is especially hot, so any speedups are good.
Diffstat (limited to 'cli/tsc/99_main_compiler.js')
-rw-r--r--cli/tsc/99_main_compiler.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js
index 0677b4c27..836d81f87 100644
--- a/cli/tsc/99_main_compiler.js
+++ b/cli/tsc/99_main_compiler.js
@@ -681,7 +681,8 @@ delete Object.prototype.__proto__;
debug(`host.writeFile("${fileName}")`);
}
return ops.op_emit(
- { fileName, data },
+ data,
+ fileName,
);
},
getCurrentDirectory() {
@@ -717,10 +718,10 @@ delete Object.prototype.__proto__;
: arg;
if (fileReference.fileName.startsWith("npm:")) {
/** @type {[string, ts.Extension] | undefined} */
- const resolved = ops.op_resolve({
- specifiers: [fileReference.fileName],
- base: containingFilePath,
- })?.[0];
+ const resolved = ops.op_resolve(
+ containingFilePath,
+ [fileReference.fileName],
+ )?.[0];
if (resolved) {
isCjsCache.maybeAdd(resolved);
return {
@@ -750,10 +751,10 @@ delete Object.prototype.__proto__;
debug(` specifiers: ${specifiers.join(", ")}`);
}
/** @type {Array<[string, ts.Extension] | undefined>} */
- const resolved = ops.op_resolve({
- specifiers,
+ const resolved = ops.op_resolve(
base,
- });
+ specifiers,
+ );
if (resolved) {
const result = resolved.map((item) => {
if (item) {