Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Moved endpoint execution outside of get_request_handler for profiling#1027

Merged
tiangolo merged 2 commits into
fastapi:masterfrom
sm-Fifteen:endpoint-profiling
Feb 29, 2020
Merged

Moved endpoint execution outside of get_request_handler for profiling#1027
tiangolo merged 2 commits into
fastapi:masterfrom
sm-Fifteen:endpoint-profiling

Conversation

@sm-Fifteen

Copy link
Copy Markdown
Contributor

At the reccomendation of @tiangolo in #701 (comment), I have moved the endpoint execution section from routing.get_request_handler.<locals>.app to a separate function (currently named _run_endpoint) in order to facilitate profiling. Internal functions and callable object properties make it difficult for profilers to identify the function object being called, and since each request is only associated to one endpoint (not counting dependencies), this makes possible to simply profile "the endpoit that was used" for any given request.

@codecov

codecov Bot commented Feb 24, 2020

Copy link
Copy Markdown

Codecov Report

Merging #1027 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1027   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         294     297    +3     
  Lines        7732    7815   +83     
======================================
+ Hits         7732    7815   +83
Impacted Files Coverage Δ
fastapi/routing.py 100% <100%> (ø) ⬆️
fastapi/dependencies/utils.py 100% <0%> (ø) ⬆️
fastapi/openapi/utils.py 100% <0%> (ø) ⬆️
fastapi/utils.py 100% <0%> (ø) ⬆️
fastapi/exceptions.py 100% <0%> (ø) ⬆️
tests/test_response_model_sub_types.py 100% <0%> (ø)
tests/test_response_model_invalid.py 100% <0%> (ø)
tests/test_param_in_path_and_dependency.py 100% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c3c9b6...29d08c4. Read the comment docs.

@tiangolo tiangolo merged commit 1ce6788 into fastapi:master Feb 29, 2020
@tiangolo

Copy link
Copy Markdown
Member

Great! I updated it a bit to re-use the precomputed is_coroutine.

Thanks for your contribution! 🚀 🎉 🍰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants