Skip to content

Commit 7d0f7ce

Browse files
authored
fix(docs): correct build optimization script and docs (#7367)
The build optimization script was removing the docs directory, which is a dependency of boto3. This change removes the line that removes the docs directory and adds a warning to the documentation to test the build after optimization. Fixes #7361
1 parent 810aadc commit 7d0f7ce

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/build_recipes/performance-optimization.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: Optimize Lambda functions for better performance and reduced costs
77

88
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.
99

10+
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.
11+
1012
## Reduce cold start times
1113

1214
1. **Minimize package size** by excluding unnecessary files

examples/build_recipes/build_optimization/optimize-advanced.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ find build/ -name "*.so.*" -exec strip --strip-debug {} \; 2>/dev/null || true
1515
rm -rf build/*/site-packages/*/tests/
1616
rm -rf build/*/site-packages/*/test/
1717
rm -rf build/*/site-packages/*/.git/
18-
rm -rf build/*/site-packages/*/docs/
1918
rm -rf build/*/site-packages/*/examples/
2019
rm -rf build/*/site-packages/*/*.md
2120
rm -rf build/*/site-packages/*/*.rst

examples/build_recipes/build_optimization/optimize-package.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ find build/ -name "*.dist-info" -type d -exec rm -rf {} +
77
find build/ -name "tests" -type d -exec rm -rf {} +
88
find build/ -name "test_*" -delete
99

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

1413
echo "✅ Package optimized"

0 commit comments

Comments
 (0)