From a1764f7690cfdc3e42724fcad29ef954b7e576a4 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Tue, 4 Apr 2023 06:46:31 -0600 Subject: 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. --- bench_util/js_runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bench_util/js_runtime.rs') diff --git a/bench_util/js_runtime.rs b/bench_util/js_runtime.rs index 4a5123a73..57085ef96 100644 --- a/bench_util/js_runtime.rs +++ b/bench_util/js_runtime.rs @@ -117,6 +117,6 @@ pub fn bench_js_async_with( } async fn inner_async(src: &'static str, runtime: &mut JsRuntime) { - runtime.execute_script("inner_loop", src).unwrap(); + runtime.execute_script_static("inner_loop", src).unwrap(); runtime.run_event_loop(false).await.unwrap(); } -- cgit v1.2.3