summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-12-03 03:07:04 +0100
committerGitHub <noreply@github.com>2023-12-03 02:07:04 +0000
commit39c7d8dafe00fd619afac7de0151790e7d53cd43 (patch)
tree3881a0cf6b92090a8d8a1457354bd8f9d26d8a70 /cli/lsp/tsc.rs
parentf6b889b43219e3c9be770c8b2758bff3048ddcbd (diff)
refactor: faster args for op_load in TSC (#21438)
This commit changes the argument that "op_load" accepts, from a serde struct to "&str". This should equal to a slightly better performance.
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs14
1 files changed, 5 insertions, 9 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index b4e02394b..210ef701a 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -3835,12 +3835,6 @@ impl State {
}
}
-#[derive(Debug, Deserialize, Serialize)]
-#[serde(rename_all = "camelCase")]
-struct SpecifierArgs {
- specifier: String,
-}
-
#[op2(fast)]
fn op_is_cancelled(state: &mut OpState) -> bool {
let state = state.borrow_mut::<State>();
@@ -3873,11 +3867,13 @@ struct LoadResponse {
fn op_load<'s>(
scope: &'s mut v8::HandleScope,
state: &mut OpState,
- #[serde] args: SpecifierArgs,
+ #[string] specifier: &str,
) -> Result<v8::Local<'s, v8::Value>, AnyError> {
let state = state.borrow_mut::<State>();
- let mark = state.performance.mark_with_args("tsc.op.op_load", &args);
- let specifier = state.specifier_map.normalize(args.specifier)?;
+ let mark = state
+ .performance
+ .mark_with_args("tsc.op.op_load", specifier);
+ let specifier = state.specifier_map.normalize(specifier)?;
let maybe_load_response =
if specifier.as_str() == "internal:///missing_dependency.d.ts" {
Some(LoadResponse {