fix(tvix/eval): Replace inner NixString repr with Box<Bstr>

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
This commit is contained in:
Aspen Smith 2024-02-10 11:29:58 -05:00 committed by clbot
parent 24a089f87d
commit e3c92ac3b4
5 changed files with 92 additions and 65 deletions

View file

@ -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),
}
}