mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
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.
This commit is contained in:
parent
2dc2016837
commit
a1764f7690
27 changed files with 817 additions and 641 deletions
|
@ -5,6 +5,7 @@ use std::rc::Rc;
|
|||
use std::sync::Arc;
|
||||
|
||||
use deno_ast::ModuleSpecifier;
|
||||
use deno_core::ascii_str;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::task::LocalFutureObj;
|
||||
use deno_core::futures::FutureExt;
|
||||
|
@ -184,7 +185,7 @@ impl CliMainWorker {
|
|||
// Enable op call tracing in core to enable better debugging of op sanitizer
|
||||
// failures.
|
||||
if self.ps.options.trace_ops() {
|
||||
self.worker.js_runtime.execute_script(
|
||||
self.worker.js_runtime.execute_script_static(
|
||||
located_script_name!(),
|
||||
"Deno[Deno.internal].core.enableOpCallTracing();",
|
||||
)?;
|
||||
|
@ -231,7 +232,7 @@ impl CliMainWorker {
|
|||
|
||||
self.worker.execute_script(
|
||||
located_script_name!(),
|
||||
"Deno[Deno.internal].core.enableOpCallTracing();",
|
||||
ascii_str!("Deno[Deno.internal].core.enableOpCallTracing();"),
|
||||
)?;
|
||||
|
||||
if mode != TestMode::Documentation {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue