mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
fix: use hash of in-memory bytes only for code cache (#23966)
* https://github.com/denoland/deno_core/pull/752 * https://github.com/denoland/deno_core/pull/753 Did benchmarking on this and it's slightly faster (couple ms) or equal to in performance as main. Closes #23904
This commit is contained in:
parent
92a8d09e49
commit
b21004b1d1
11 changed files with 93 additions and 174 deletions
|
@ -63,17 +63,6 @@ pub fn specifier_to_file_path(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn code_timestamp(specifier: &str) -> Result<u64, AnyError> {
|
||||
let specifier = ModuleSpecifier::parse(specifier)?;
|
||||
let path = specifier_to_file_path(&specifier)?;
|
||||
#[allow(clippy::disallowed_methods)]
|
||||
let timestamp = std::fs::metadata(path)?
|
||||
.modified()?
|
||||
.duration_since(std::time::UNIX_EPOCH)?
|
||||
.as_millis() as u64;
|
||||
Ok(timestamp)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue