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

(aws-cdk-lib): Slow Python import times #21695

Closed
pauldraper opened this issue Aug 22, 2022 · 6 comments
Closed

(aws-cdk-lib): Slow Python import times #21695

pauldraper opened this issue Aug 22, 2022 · 6 comments
Assignees
Labels
aws-cdk-lib Related to the aws-cdk-lib package bug This issue is a bug. effort/large Large work item – several weeks of effort p2

Comments

@pauldraper
Copy link

pauldraper commented Aug 22, 2022

Describe the bug

import aws_cdk takes a long time.

Expected Behavior

I expected importing to take less than 2s.

Comparisons:

python -c 'import boto3' takes ~200ms.

node -e 'require("aws-cdk-lib")' takes ~850ms.

Current Behavior

python -c 'import aws_cdk' takes 5s.

Reproduction Steps

time python -c 'import aws_cdk'

real	0m5.290s
user	0m5.562s
sys	0m0.659s

Possible Solution

Remove the dozens of imports from __init__.py, most of which are unnecessary for most users.

Additional Information/Context

This makes even the simplest commands like cdk list bizarrely slow even for small projects.

CDK CLI Version

2.37.0

Framework Version

No response

Node.js Version

18

OS

Ubuntu 20.04

Language

Python

Language Version

Python 3.8

Other information

No response

@pauldraper pauldraper added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Aug 22, 2022
@github-actions github-actions bot added the aws-cdk-lib Related to the aws-cdk-lib package label Aug 22, 2022
@peterwoodworth
Copy link
Contributor

Sorry about the length of time this takes,

Remove the dozens of imports from init.py, most of which are unnecessary for most users

Which imports do you think are unnecessary?

@peterwoodworth peterwoodworth added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. effort/large Large work item – several weeks of effort and removed needs-triage This issue or PR still needs to be triaged. labels Aug 22, 2022
@github-actions
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Aug 25, 2022
@pauldraper
Copy link
Author

More details here: aws/jsii#3389 (comment)

@github-actions github-actions bot removed closing-soon This issue will automatically close in 4 days unless further comments are made. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. labels Aug 28, 2022
@peterwoodworth
Copy link
Contributor

Thanks for linking this issue, this is a jsii issue so that existing issue will be the best place to track this. Thanks again

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@bafonso
Copy link

bafonso commented Jan 24, 2023

We are just now starting to use CDK v2 after years of using v1 and the workflow is abysmally slow. AWS-CDK developers really need to re-think if packaging everything makes sense. Almost half a year later and no solution in sight, we are now forced to re-consider using terraform. Sorry for venting but I wonder how this slowness is not problematic for most python developers, assuming there were enough testers involved during aws-cdk v2 development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws-cdk-lib Related to the aws-cdk-lib package bug This issue is a bug. effort/large Large work item – several weeks of effort p2
Projects
None yet
Development

No branches or pull requests

4 participants