Architecture and Best Practices
AWS makes regular improvements to the underlying components of the Lambda services, including the networking and compute layers. Lambda developers automatically benefit from these improvements without having to make any changes to their functions.
To optimize your functions, it’s best practice to focus on the parts of the Lambda execution lifecycle where developers can have the most impact. The initialization code outside of the handler, and the handler code itself, are both important areas for customer-focused optimization. Combined with the ongoing improvements made by the Lambda service, focusing on these areas is the best way to optimize overall performance.