Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/build_recipes/performance-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ description: Optimize Lambda functions for better performance and reduced costs

Optimize your Lambda functions for better performance, reduced cold start times, and lower costs. These techniques help minimize package size, improve startup speed, and reduce memory usage.

Always validate your function's behavior after applying optimizations to ensure an optimization hasn't introduced any issues with your packages. For example, removal of directories that appear to be unnecessary, such as `docs`, can break some libraries.

## Reduce cold start times

1. **Minimize package size** by excluding unnecessary files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ find build/ -name "*.so.*" -exec strip --strip-debug {} \; 2>/dev/null || true
rm -rf build/*/site-packages/*/tests/
rm -rf build/*/site-packages/*/test/
rm -rf build/*/site-packages/*/.git/
rm -rf build/*/site-packages/*/docs/
rm -rf build/*/site-packages/*/examples/
rm -rf build/*/site-packages/*/*.md
rm -rf build/*/site-packages/*/*.rst
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ find build/ -name "*.dist-info" -type d -exec rm -rf {} +
find build/ -name "tests" -type d -exec rm -rf {} +
find build/ -name "test_*" -delete

# Remove documentation and examples
find build/ -name "docs" -type d -exec rm -rf {} +
# Remove examples
find build/ -name "examples" -type d -exec rm -rf {} +

echo "✅ Package optimized"