Commit 7970932
committed
perf: pass template dict directly to Template, skip yaml round-trip
Template.__init__ now accepts an optional template_dict parameter.
When provided, it skips both file reading and yaml_parse, avoiding
the deepcopy → yaml_dump → yaml_parse round-trip that package_context
and artifact_exporter were doing.
For large templates with many Fn::ForEach expansions, this eliminates
two O(n) serialization passes (yaml_dump + yaml_parse) per export.1 parent 3a97220 commit 7970932
3 files changed
Lines changed: 13 additions & 7 deletions
File tree
- samcli
- commands/package
- lib/package
- tests/unit/lib/package
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
197 | 196 | | |
198 | | - | |
| 197 | + | |
| 198 | + | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
206 | | - | |
| 206 | + | |
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
| 354 | + | |
354 | 355 | | |
355 | 356 | | |
356 | 357 | | |
357 | 358 | | |
358 | | - | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
359 | 365 | | |
360 | 366 | | |
361 | 367 | | |
| |||
367 | 373 | | |
368 | 374 | | |
369 | 375 | | |
370 | | - | |
| 376 | + | |
371 | 377 | | |
372 | 378 | | |
373 | 379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2424 | 2424 | | |
2425 | 2425 | | |
2426 | 2426 | | |
2427 | | - | |
| 2427 | + | |
2428 | 2428 | | |
2429 | 2429 | | |
2430 | 2430 | | |
| |||
0 commit comments