summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2023-04-04 06:46:31 -0600
committerGitHub <noreply@github.com>2023-04-04 06:46:31 -0600
commita1764f7690cfdc3e42724fcad29ef954b7e576a4 (patch)
tree1b621ebd7a6ef50687eeb2061740895096136e8a /cli/lsp/tsc.rs
parent2dc20168371e827b86e2ce0d1d7787139fba68f3 (diff)
refactor(core): Improve ergonomics of managing ASCII strings (#18498)
This is a follow-on to the earlier work in reducing string copies, mainly focused on ensuring that ASCII strings are easy to provide to the JS runtime. While we are replacing a 16-byte reference in a number of places with a 24-byte structure (measured via `std::mem::size_of`), the reduction in copies wins out over the additional size of the arguments passed into functions. Benchmarking shows approximately the same if not slightly less wallclock time/instructions retired, but I believe this continues to open up further refactoring opportunities.
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index ef5d0e645..e236eee0a 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -2899,7 +2899,7 @@ fn start(runtime: &mut JsRuntime, debug: bool) -> Result<(), AnyError> {
let init_config = json!({ "debug": debug });
let init_src = format!("globalThis.serverInit({init_config});");
- runtime.execute_script(located_script_name!(), init_src)?;
+ runtime.execute_script(located_script_name!(), init_src.into())?;
Ok(())
}
@@ -3493,7 +3493,7 @@ pub fn request(
};
let mark = performance.mark("request", Some(request_params.clone()));
let request_src = format!("globalThis.serverRequest({request_params});");
- runtime.execute_script(located_script_name!(), request_src)?;
+ runtime.execute_script(located_script_name!(), request_src.into())?;
let op_state = runtime.op_state();
let mut op_state = op_state.borrow_mut();