Skip to content

Commit b597a6b

Browse files
author
Mark McCaskey
committed
Use Box<[Type]> inside of FunctionType`
This saves 16 bytes (on 64bit systems) on the stack for each `FunctionType` and additional space on the heap by not allowing resizing (like Vec does)
1 parent e8344c5 commit b597a6b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/wasmer-types/src/types.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ impl ExternType {
229229
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
230230
pub struct FunctionType {
231231
/// The parameters of the function
232-
params: Vec<Type>,
232+
params: Box<[Type]>,
233233
/// The return values of the function
234-
results: Vec<Type>,
234+
results: Box<[Type]>,
235235
}
236236

237237
impl FunctionType {
@@ -242,8 +242,8 @@ impl FunctionType {
242242
Returns: Into<Vec<Type>>,
243243
{
244244
Self {
245-
params: params.into(),
246-
results: returns.into(),
245+
params: params.into().into_boxed_slice(),
246+
results: returns.into().into_boxed_slice(),
247247
}
248248
}
249249

0 commit comments

Comments
 (0)