Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
335 stars 103 forks source link

[WIP] Add microbenchmarks and improve efficiency of core functions #1041

Open tonybaloney opened 2 years ago

tonybaloney commented 2 years ago

Introduces a pytest extension "pytest-benchmark" and runs microbenchmarks of key functions within the worker process.

This PR will also include some optimizations.

Fork of #1039 - so that should be merged first

tonybaloney commented 2 years ago
screenshot 2022-05-23 at 13 44 42

Comparison of first patch https://github.com/Azure/azure-functions-python-worker/pull/1041/commits/699bbbcd013116a272ed46e40a4fb5a7b93c0eaf refactoring the build_binding_protos() function with 0-9 bindings shows a consistent 10-15% reduction in execution time.

tonybaloney commented 2 years ago
screenshot 2022-05-23 at 15 59 51 screenshot 2022-05-23 at 16 01 27

Profiles for loader.index_function_app() are showing the function is relatively slow because: