Skip to content

Commit bb24c90

Browse files
committed
Preallocate vector for headers
1 parent 2285ff8 commit bb24c90

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/protocols/serialize/EventStreamMarshallerGenerator.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ open class EventStreamMarshallerGenerator(
9090
""",
9191
*codegenScope,
9292
) {
93-
rustTemplate("let mut headers = #{Vec}::new();", *codegenScope)
93+
rustTemplate("let mut headers = #{Vec}::with_capcity(3);", *codegenScope)
9494
addStringHeader(":message-type", "\"event\".into()")
9595
addStringHeader(":event-type", "\"initial-request\".into()")
9696
addStringHeader(":content-type", "${contentType.dq()}.into()")
@@ -119,7 +119,7 @@ open class EventStreamMarshallerGenerator(
119119
""",
120120
*codegenScope,
121121
) {
122-
rustTemplate("let mut headers = #{Vec}::new();", *codegenScope)
122+
rustTemplate("let mut headers = #{Vec}::with_capacity(3);", *codegenScope)
123123
addStringHeader(":message-type", "\"event\".into()")
124124
addStringHeader(":event-type", "\"initial-response\".into()")
125125
addStringHeader(":content-type", "${contentType.dq()}.into()")

0 commit comments

Comments
 (0)