about summary refs log tree commit diff
path: root/tvix/glue/src/tvix_store_io.rs
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-02-10T16·29-0500
committerclbot <clbot@tvl.fyi>2024-02-13T16·49+0000
commite3c92ac3b4b07a7397b565738ec4237b9bf621f6 (patch)
tree0cb85c787223782f3eb5fc628e7ffd0ed309f122 /tvix/glue/src/tvix_store_io.rs
parent24a089f87d8a80a2d31c5440b40f72ee466417e7 (diff)
fix(tvix/eval): Replace inner NixString repr with Box<Bstr> r/7506
Storing a full BString here incurs the extra overhead of the capacity
for the inner byte-vector, which we basically never use as Nix strings
are immutable (and we don't do any mutation / sharing analysis).
Switching to a Box<BStr> cuts us from 72 bytes to 64 bytes per
string (and there are a lot of strings!)

Change-Id: I11f34c14a08fa02759f260b1c78b2a2b981714e4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10794
Autosubmit: aspen <root@gws.fyi>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/glue/src/tvix_store_io.rs')
-rw-r--r--tvix/glue/src/tvix_store_io.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/glue/src/tvix_store_io.rs b/tvix/glue/src/tvix_store_io.rs
index 4146ededb40c..ed06eba89686 100644
--- a/tvix/glue/src/tvix_store_io.rs
+++ b/tvix/glue/src/tvix_store_io.rs
@@ -297,7 +297,7 @@ impl EvalIO for TvixStoreIO {
 mod tests {
     use std::{path::Path, rc::Rc, sync::Arc};
 
-    use bstr::ByteVec;
+    use bstr::ByteSlice;
     use tempfile::TempDir;
     use tvix_build::buildservice::DummyBuildService;
     use tvix_castore::{
@@ -356,7 +356,7 @@ mod tests {
 
         let value = result.value.expect("must be some");
         match value {
-            tvix_eval::Value::String(s) => Some((***s).clone().into_string_lossy()),
+            tvix_eval::Value::String(s) => Some(s.to_str_lossy().into_owned()),
             _ => panic!("unexpected value type: {:?}", value),
         }
     }