about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-02-02T10·14+0300
committerclbot <clbot@tvl.fyi>2023-02-02T14·25+0000
commit75d1b72b7c8619692999df339471aee7aab5a085 (patch)
tree1279ab5ba32f0c1c0bb4531c419e110de9bd9645 /tvix/eval/src/vm.rs
parent98ea614c6e9ea9428dc10dde630abf894bd01473 (diff)
refactor(tvix/eval): import_cache can be a HashMap r/5822
... instead of a BTreeMap, as we do not need ordering guarantees here.
HashMaps are noticeably faster here (especially as we've been sorting
essentially random data!).

Change-Id: Ie92d74286df9f763c04c9b226ef1066ee8484c13
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8014
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Autosubmit: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 93bf853f9c26..46c9f79b2e57 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -2,7 +2,7 @@
 //! Tvix bytecode.
 
 use serde_json::json;
-use std::{cmp::Ordering, collections::BTreeMap, ops::DerefMut, path::PathBuf, rc::Rc};
+use std::{cmp::Ordering, collections::HashMap, ops::DerefMut, path::PathBuf, rc::Rc};
 
 use crate::{
     chunk::Chunk,
@@ -113,7 +113,7 @@ pub struct VM<'o> {
     /// Import cache, mapping absolute file paths to the value that
     /// they compile to. Note that this reuses thunks, too!
     // TODO: should probably be based on a file hash
-    pub import_cache: Box<BTreeMap<PathBuf, Value>>,
+    pub import_cache: Box<HashMap<PathBuf, Value>>,
 
     /// Parsed Nix search path, which is used to resolve `<...>`
     /// references.