Commit 4123f80
committed
Use Vec::with_capacity(1) in a couple of places.
Because Vec::new() + push() results in a capacity of 4, and these
particular vectors almost never grow past a length of 1.
This change reduces the number of bytes of heap allocation
significantly. (For serde it's a 15% reduction for a debug build.) This
didn't give noticeable speed-ups on my machine but it's a trivial change
and certainly can't hurt.1 parent 6fc409e commit 4123f80
2 files changed
+8
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
| 213 | + | |
213 | 214 | | |
214 | 215 | | |
215 | 216 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
601 | 605 | | |
602 | 606 | | |
603 | 607 | | |
| |||
0 commit comments