about summary refs log tree commit diff
path: root/tvix/eval/src/compiler.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-11T16·02+0300
committertazjin <tazjin@tvl.su>2022-08-26T15·06+0000
commit999b9c7a138a5dd5277085570042fc67a893e5af (patch)
treee7eb2baadeb0a172e2b6c48c1644f6604c58d769 /tvix/eval/src/compiler.rs
parentf331874aeb6ed528d667f8737d1d0b1c6f6f61cf (diff)
refactor(tvix/value): replace static representation with SmolStr r/4498
The only uses of the static variant were for `"name"` and `"value"`,
which are both small enough to fit into a SmolStr. The size of
NixString accomodates `String` anyways, so we may as well inline them.

Additionally smol_str is already in the dependency graph because rnix
uses it, and using it for representations of identifiers is sensible.

Change-Id: I9969312256d1657d69128e54c47dc7294a18ce58
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6165
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/compiler.rs')
-rw-r--r--tvix/eval/src/compiler.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler.rs b/tvix/eval/src/compiler.rs
index b9e850a36b7e..622acf982252 100644
--- a/tvix/eval/src/compiler.rs
+++ b/tvix/eval/src/compiler.rs
@@ -105,7 +105,7 @@ impl Compiler {
             let ident = rnix::types::Ident::cast(node).unwrap();
             let idx = self
                 .chunk
-                .add_constant(Value::String(ident.as_str().to_string().into()));
+                .add_constant(Value::String(ident.as_str().into()));
             self.chunk.add_op(OpCode::OpConstant(idx));
             return Ok(());
         }
@@ -275,7 +275,7 @@ impl Compiler {
                         // TODO(tazjin): intern!
                         let idx = self
                             .chunk
-                            .add_constant(Value::String(ident.as_str().to_string().into()));
+                            .add_constant(Value::String(ident.as_str().into()));
                         self.chunk.add_op(OpCode::OpConstant(idx));
                     }