From 49b106b0cb996dd4bf5a5d4ecabc2a7e40025a5f Mon Sep 17 00:00:00 2001 From: edef Date: Mon, 9 Oct 2023 17:32:37 +0000 Subject: fix(tvix/nix-compat): don't transiently allocate names 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. Change-Id: I65647e5c4e54e88f1fe45e9a752cb5154d98fb33 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9607 Autosubmit: edef Reviewed-by: flokli Tested-by: BuildkiteCI --- tvix/nix-compat/src/nar/writer/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tvix/nix-compat') 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)?; } -- cgit 1.4.1