refactor(tvix/value): replace static representation with SmolStr
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>
This commit is contained in:
parent
f331874aeb
commit
999b9c7a13
5 changed files with 15 additions and 12 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue