mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
perf: more efficient deno cache
and npm package info usage (#16592)
1. There was a lot of cloning going on with `NpmPackageInfo`. This is now stored in an `Arc<NpmPackageInfo>` and cloning only happens on the individual version. 2. The package cache is now cleared from memory after resolution. 3. This surfaced a bug in `deno cache` and I noticed it can be more efficient if we have multiple root specifiers if we provide all the specifiers as roots.
This commit is contained in:
parent
7f0546a6b7
commit
8dc242f789
6 changed files with 84 additions and 59 deletions
28
cli/main.rs
28
cli/main.rs
|
@ -284,23 +284,23 @@ async fn check_command(
|
|||
|
||||
async fn load_and_type_check(
|
||||
ps: &ProcState,
|
||||
files: &Vec<String>,
|
||||
files: &[String],
|
||||
) -> Result<(), AnyError> {
|
||||
let lib = ps.options.ts_type_lib_window();
|
||||
|
||||
for file in files {
|
||||
let specifier = resolve_url_or_path(file)?;
|
||||
|
||||
ps.prepare_module_load(
|
||||
vec![specifier],
|
||||
false,
|
||||
lib,
|
||||
Permissions::allow_all(),
|
||||
Permissions::allow_all(),
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
let specifiers = files
|
||||
.iter()
|
||||
.map(|file| resolve_url_or_path(file))
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
ps.prepare_module_load(
|
||||
specifiers,
|
||||
false,
|
||||
lib,
|
||||
Permissions::allow_all(),
|
||||
Permissions::allow_all(),
|
||||
false,
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue