Skip to content

Conversation

acristin
Copy link
Contributor

Profiling indicated that we spend a lot of time in our custom deepcopy, mostly due to maintaining compatibility with python2.7 hashes and their ordering of keys. If we change the ordering of keys, we will change logical IDs of some generated resources, breaking backwards compatibility.

We found that during the hashing code, we made some 13MM calls to Hash.hash, but with caching this is reduced to 1040 calls for a large test template.

On my laptop, this reduces wall clock time from ~15s to ~13s, or ~34s to ~27s with cProfiler.

Issue #, if available

Description of changes

Description of how you validated changes

Checklist

Examples?

Please reach out in the comments if you want to add an example. Examples will be
added to sam init through aws/aws-sam-cli-app-templates.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@acristin acristin requested a review from a team as a code owner December 14, 2022 21:27
@acristin acristin enabled auto-merge (squash) December 14, 2022 22:00
@aahung
Copy link
Contributor

aahung commented Dec 14, 2022

on 2019 16-inch macbook pro, 42.8s -> 34.8s: 19% less time

@acristin acristin merged commit 88fa800 into aws:develop Dec 14, 2022
@acristin acristin deleted the cache_hash branch December 15, 2022 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants