diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2022-06-20 13:42:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 14:42:20 +0200 |
commit | 79b42808a474c0a049ae17a3b6b1f93ad83d217b (patch) | |
tree | 937c16d6f2c5928a784ed28e60dffe18c3517643 /core/runtime.rs | |
parent | 94d369ebc65a55bd9fbf378a765c8ed88a4efe2c (diff) |
perf(core): Cache source lookups (#14816)
Keep a cache for source maps and source lines.
We sort of already had a cache argument for source map lookup
functions but we just passed an empty map instead of storing it.
Extended it to cache source line lookups as well and plugged it
into runtime state.
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 4ca1247f6..97c822848 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -17,6 +17,7 @@ use crate::modules::NoopModuleLoader; use crate::op_void_async; use crate::op_void_sync; use crate::ops::*; +use crate::source_map::SourceMapCache; use crate::source_map::SourceMapGetter; use crate::Extension; use crate::OpMiddlewareFn; @@ -163,6 +164,7 @@ pub(crate) struct JsRuntimeState { /// of the event loop. dyn_module_evaluate_idle_counter: u32, pub(crate) source_map_getter: Option<Box<dyn SourceMapGetter>>, + pub(crate) source_map_cache: SourceMapCache, pub(crate) pending_ops: FuturesUnordered<PendingOpFuture>, pub(crate) unrefed_ops: HashSet<i32>, pub(crate) have_unpolled_ops: bool, @@ -391,6 +393,7 @@ impl JsRuntime { has_tick_scheduled: false, js_wasm_streaming_cb: None, source_map_getter: options.source_map_getter, + source_map_cache: Default::default(), pending_ops: FuturesUnordered::new(), unrefed_ops: HashSet::new(), shared_array_buffer_store: options.shared_array_buffer_store, |