about summary refs log tree commit diff
path: root/tvix/nix-compat/src/nar/writer
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2023-10-09T17·32+0000
committeredef <edef@edef.eu>2023-10-09T18·22+0000
commit49b106b0cb996dd4bf5a5d4ecabc2a7e40025a5f (patch)
tree20293ac551e6b56a66556eae25205facce80e1f9 /tvix/nix-compat/src/nar/writer
parenteb167c71a779b978a1fd4d6cd29fdf47268c578d (diff)
fix(tvix/nix-compat): don't transiently allocate names r/6752
The point of clearing and reusing the same Vec is to avoid transiently
allocating for every directory entry. This was lost in cl/8974 when we
switched from String to Vec<u8>.

Change-Id: I65647e5c4e54e88f1fe45e9a752cb5154d98fb33
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9607
Autosubmit: edef <edef@edef.eu>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/nix-compat/src/nar/writer')
-rw-r--r--tvix/nix-compat/src/nar/writer/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/nix-compat/src/nar/writer/mod.rs b/tvix/nix-compat/src/nar/writer/mod.rs
index f018e4212e80..71625420cc19 100644
--- a/tvix/nix-compat/src/nar/writer/mod.rs
+++ b/tvix/nix-compat/src/nar/writer/mod.rs
@@ -188,7 +188,7 @@ impl<'a, 'w> Directory<'a, 'w> {
                         "misordered names: {_prev_name:?} >= {name:?}"
                     );
                     _prev_name.clear();
-                    _prev_name.append(&mut name.to_vec());
+                    _prev_name.extend_from_slice(name);
                 }
                 self.node.write(&wire::TOK_PAR)?;
             }