diff --git a/crates/oxc_transformer/src/helpers/stack/capacity.rs b/crates/oxc_transformer/src/helpers/stack/capacity.rs index 9439726b778484..b7ec1c311009a2 100644 --- a/crates/oxc_transformer/src/helpers/stack/capacity.rs +++ b/crates/oxc_transformer/src/helpers/stack/capacity.rs @@ -37,11 +37,12 @@ pub trait StackCapacity { /// Default capacity of stack. /// - /// Same defaults as [`std::vec::Vec`] uses. + /// Same defaults as [`std::vec::Vec`] uses, except 16 bytes for types with size 1 (instead of 8). + /// Allocators will usually allocate minimum 16 bytes anyway. const DEFAULT_CAPACITY: usize = { // It's impossible for this to exceed `MAX_CAPACITY` because `size_of::() >= align_of::()` match size_of::() { - 1 => 8, + 1 => 16, size if size <= 1024 => 4, _ => 1, }