Commit Graph

2 Commits

Author SHA1 Message Date
Joshua Wong
97005678c3 reduce Box::default stack copies in debug mode
The `Box::new(T::default())` implementation of `Box::default` only
had two stack copies in debug mode, compared to the current version,
which has four. By avoiding creating any `MaybeUninit<T>`'s and just writing
`T` directly to the `Box` pointer, the stack usage in debug mode remains
the same as the old version.
2025-01-26 03:48:27 -05:00
Joshua Wong
80faf20351 add test for Box::default's stack usage in debug mode 2025-01-26 03:48:27 -05:00