Skip to content

Conversation

aahung
Copy link
Contributor

@aahung aahung commented Jan 10, 2023

Issue #, if available

Tested on a template with 411 Api event sources. By looking at the profile result, get_partition_name() is called 824 times, making up 10.76s (out of 47s, ~23%).

824	0.004326	5.25e-06	10.76	0.01306	arn_generator.py:38(get_partition_name)

After this change, it only called twice and only took 0.01s.

2 | 1.1e-05 | 5.5e-06 | 0.01354 | 0.006768 | arn_generator.py:40(get_partition_name)

this brought down the time from 47s to 40s (the duration fluctuates so it doesn't have exact 10.76s difference).

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.

@aahung aahung marked this pull request as ready for review January 10, 2023 22:13
@aahung aahung requested a review from a team as a code owner January 10, 2023 22:13
@aahung aahung force-pushed the cache-get_partition_name branch from 1f7f38e to 05958e3 Compare January 10, 2023 22:49
Copy link
Contributor

@acristin acristin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aahung aahung merged commit 96ea2d0 into aws:develop Jan 10, 2023
@aahung aahung deleted the cache-get_partition_name branch January 10, 2023 23:11
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.

5 participants