Performance: Automatic API documentation (Swagger UI)
MEDIUM IMPACT
This affects the initial page load speed and rendering performance of the API docs interface.
from fastapi import FastAPI app = FastAPI(docs_url=None) # disable default docs # Serve Swagger UI only on demand or use lightweight alternative # Or customize to lazy load Swagger UI assets
from fastapi import FastAPI app = FastAPI(docs_url='/docs') # default Swagger UI enabled # No customization or lazy loading
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Default Swagger UI enabled | Moderate (complex DOM for UI) | Multiple reflows during load | High paint cost due to heavy CSS/JS | [X] Bad |
| Swagger UI disabled or lazy loaded | Minimal DOM initially | Single reflow on demand | Lower paint cost, faster rendering | [OK] Good |