From 39c7d8dafe00fd619afac7de0151790e7d53cd43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 3 Dec 2023 03:07:04 +0100 Subject: 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. --- cli/lsp/tsc.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'cli/lsp') 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::(); @@ -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, AnyError> { let state = state.borrow_mut::(); - 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 { -- cgit v1.2.3