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<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
This commit is contained in:
edef 2023-10-09 17:32:37 +00:00
parent eb167c71a7
commit 49b106b0cb

View file

@ -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)?;
}