From 23ae567ae68dc5209c630bf7a08d8abc9d9ccbbd Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Sat, 4 Oct 2025 17:14:04 +0200 Subject: [PATCH] nak: add all identical values in one step Part-of: --- src/nouveau/compiler/nak/hw_tests.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/nouveau/compiler/nak/hw_tests.rs b/src/nouveau/compiler/nak/hw_tests.rs index 3204efa8382..0bb55639aa9 100644 --- a/src/nouveau/compiler/nak/hw_tests.rs +++ b/src/nouveau/compiler/nak/hw_tests.rs @@ -432,7 +432,7 @@ pub fn test_foldable_op_with( // to give us 2500 iterations. let invocations = src_comps * src_comps * 100; - let mut data = Vec::new(); + let mut data = Vec::with_capacity(invocations * (dst_comps + src_comps)); for _ in 0..invocations { for (i, src) in op.srcs_as_slice().iter().enumerate() { let SrcRef::SSA(vec) = &src.src_ref else { @@ -449,9 +449,7 @@ pub fn test_foldable_op_with( } } } - for _ in 0..dst_comps { - data.push(0_u32); - } + data.extend(std::iter::repeat_n(0_u32, dst_comps)); } debug_assert!(data.len() == invocations * comps);