Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.7k
📝 Tweak middleware code sampletime.time() totime.perf_counter()#11957
Merged
estebanx64 merged 4 commits intofastapi:masterfromAug 31, 2024
Merged
📝 Tweak middleware code sampletime.time() totime.perf_counter()#11957estebanx64 merged 4 commits intofastapi:masterfrom
time.time() totime.perf_counter()#11957estebanx64 merged 4 commits intofastapi:masterfrom
Conversation
Contributor
📝 Docs preview for commit7ff5da8 at:https://c67f77ea.fastapitiangolo.pages.dev |
Contributor
📝 Docs preview for commitead4f8c at:https://05caad5c.fastapitiangolo.pages.dev |
Contributor
📝 Docs preview for commit866c698 at:https://07e36968.fastapitiangolo.pages.dev |
Contributor
📝 Docs preview for commit6ca7b8c at:https://b84f71cf.fastapitiangolo.pages.dev |
Contributor
estebanx64 commentedAug 31, 2024
Hi@domdent 👋 Thanks for your interest in helping us to improve the docs. 🙇 It seems the perf_counter is better for this scenario since it provides a high-resolution time counter for measuring short durations. It's gonna be merged now. 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
time.time()→time.perf_counter()Given the performance of FastAPI,time.perf_counter offers a more accurate way to time short durations: "clock with the highest available resolution to measure a short duration".