From b21004b1d16ad7b67c7b1cd235abf792bf9d9777 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 24 May 2024 10:15:46 -0400 Subject: 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 --- runtime/code_cache.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'runtime/code_cache.rs') diff --git a/runtime/code_cache.rs b/runtime/code_cache.rs index ccc070365..2a56543a4 100644 --- a/runtime/code_cache.rs +++ b/runtime/code_cache.rs @@ -1,5 +1,7 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. +use deno_core::ModuleSpecifier; + pub enum CodeCacheType { EsModule, Script, @@ -17,15 +19,15 @@ impl CodeCacheType { pub trait CodeCache: Send + Sync { fn get_sync( &self, - specifier: &str, + specifier: &ModuleSpecifier, code_cache_type: CodeCacheType, - source_hash: &str, + source_hash: u64, ) -> Option>; fn set_sync( &self, - specifier: &str, + specifier: ModuleSpecifier, code_cache_type: CodeCacheType, - source_hash: &str, + source_hash: u64, data: &[u8], ); } -- cgit v1.2.3