1
Fork 0

Rollup merge of #135365 - saethlin:box-new, r=compiler-errors

Update the explanation for why we use box_new in vec!

The perf run in this PR demonstrates that there is no longer a dramatic change in compile time with the intrinsic `box_new` vs calling `Box::new`, but I've locally confirmed that there is still a dramatic change in stack use.
This commit is contained in:
Guillaume Gomez 2025-01-12 23:08:58 +01:00 committed by GitHub
commit 24cc0cb6fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -48,8 +48,8 @@ macro_rules! vec {
);
($($x:expr),+ $(,)?) => (
<[_]>::into_vec(
// Using the intrinsic produces a dramatic improvement in compile
// time when constructing arrays with many elements.
// Using the intrinsic produces a dramatic improvement in stack usage for
// unoptimized programs using this code path to construct large Vecs.
$crate::boxed::box_new([$($x),+])
)
);