From 5a57c67b8e56790e342b29bb1c9c1f2d2681b409 Mon Sep 17 00:00:00 2001 From: Malak khoder Date: Sun, 14 Dec 2025 22:21:12 +0200 Subject: [PATCH] docs: add async usage tip for clarity --- docs/en/docs/index.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/en/docs/index.md b/docs/en/docs/index.md index b0acc9926..94bf7e1f2 100644 --- a/docs/en/docs/index.md +++ b/docs/en/docs/index.md @@ -178,6 +178,9 @@ def read_item(item_id: int, q: Union[str, None] = None): Or use async def... > **Tip:** Use `async def` when performing I/O-bound operations to fully benefit from FastAPI's asynchronous performance. +**Tip**: Use `async def` only when your code performs non-blocking I/O +(e.g. database calls, external APIs). For CPU-bound or blocking code, +prefer `def` to avoid performance issues. ```Python hl_lines="9 14"