-
Notifications
You must be signed in to change notification settings - Fork 292
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
Make use of compiled .pyc files to speed-up lambda cold starts and further slim the package size #762
Comments
Can you solve this by using a custom slim pattern to remove the .py files? |
No, it is a 2 step process
The 2nd step is currently not achievable. |
Ah thanks @hrist0stoichev - perhaps there is a way to hook into the packaging, I may also try to provide a custom built artifact. I'm noticing ~3 seconds of START_INIT time on cold boot, and my only direct dependency is |
I doubt compiling takes that long in your case. You can try creating an import profile with https://github.com/nschloe/tuna and see where you spend the majority of time. |
is there any way, currently, to intercept or hook into the requirements installation to do this in userland? |
Only way I can think of doing this right now is to build + deploy the package in two separate steps, and before deploying unzip the package, modify as needed (generate 🤔 |
Is there an existing issue for this?
Use case description
Right now
slim: true
will remove all.pyc
and.pyo
files but those are actually more useful than.py
files for 2 main reasons:.py
files.Going even deeper, the
-OO
flag can be used so that.pyo
files are even smaller.Proposed solution (optional)
On this flow chart you can see how the python lookup-mechanism works.
So, the easiest solution would be to just replace all
.py
files with their.py[c|o]
counterparts coming from__pycache__
.The text was updated successfully, but these errors were encountered: