summaryrefslogtreecommitdiff
path: root/cli/module_loader.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-10-26 13:41:09 -0400
committerGitHub <noreply@github.com>2024-10-26 13:41:09 -0400
commitf0f476e58453d502ab5c118fc91d1475e6829967 (patch)
treec587c81f345a87cc5c61c36242230cb26321a5a9 /cli/module_loader.rs
parentd92d2fe9b0bd5e6e29cb3b6f924472aec972b636 (diff)
perf: pass transpiled module to deno_core as known string (#26555)
Diffstat (limited to 'cli/module_loader.rs')
-rw-r--r--cli/module_loader.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/cli/module_loader.rs b/cli/module_loader.rs
index 37d42f78e..4a020516e 100644
--- a/cli/module_loader.rs
+++ b/cli/module_loader.rs
@@ -541,7 +541,8 @@ impl<TGraphContainer: ModuleGraphContainer>
self.parsed_source_cache.free(specifier);
Ok(Some(ModuleCodeStringSource {
- code: ModuleSourceCode::Bytes(transpile_result),
+ // note: it's faster to provide a string if we know it's a string
+ code: ModuleSourceCode::String(transpile_result.into()),
found_url: specifier.clone(),
media_type,
}))
@@ -571,7 +572,8 @@ impl<TGraphContainer: ModuleGraphContainer>
self.parsed_source_cache.free(specifier);
Ok(Some(ModuleCodeStringSource {
- code: ModuleSourceCode::Bytes(transpile_result),
+ // note: it's faster to provide a string if we know it's a string
+ code: ModuleSourceCode::String(transpile_result.into()),
found_url: specifier.clone(),
media_type,
}))