Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lru_cache on costly validation function. #291

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Nov 29, 2023

This gave me a 24% speedup when downloading a folder with 30,000 small files using aws s3 cp with preferred_transfer_client=crt on a 100Gbps machine. It speeds up the classic transfer client as well.

When profiling this workload, _validate_subscriber_methods() had a big presence in the flame graph. Commenting out the validate function gave a huge speedup. But the validation is useful, so we didn't want to remove it. Using lru_cache provides the same speedup for the 30,000 file workload. It runs 6 times (once per subscriber class) instead of 180,000 times (6 times per file).

This gives a 24% speedup when downloading a folder with 30,000 small files using the CRT via CLI.

When profiling this workload, `_validate_subscriber_methods()` had a big presence in the flame graph. Commenting out the validate function gave a huge speedup. But the validation is useful, so we didn't want to remove it. Using lru_cache provides the same speedup for the 30,000 file workload. It runs 6 times (once per subscriber class) instead of 180,000 times (6 times per file).
Copy link
Contributor

@nateprewitt nateprewitt left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Member

@kyleknap kyleknap left a comment

Choose a reason for hiding this comment

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

🚢

@nateprewitt nateprewitt merged commit 67a91d5 into boto:develop Nov 29, 2023
15 checks passed
@graebm graebm deleted the validation-speedup branch November 29, 2023 17:53
aws-sdk-python-automation added a commit that referenced this pull request Nov 29, 2023
* release-0.8.2:
  Bumping version to 0.8.2
  Scope awscrt.s3 imports to functions (#293)
  Add changelog for subscribers cache (#292)
  Use lru_cache on costly validation function. (#291)
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.

None yet

3 participants