Performance: What is Django
MEDIUM IMPACT
Django affects server-side page generation speed and how quickly content is sent to the browser, impacting initial load time.
def view(request): data = Model.objects.all()[:20] # limit to 20 items return render(request, 'template.html', {'data': data})
def view(request): data = Model.objects.all() return render(request, 'template.html', {'data': data})
| Pattern | Server Processing | Network Transfer | Browser Rendering | Verdict |
|---|---|---|---|---|
| Fetching all data without limits | High CPU and DB load | Large HTML size | Normal | [X] Bad |
| Limiting data and caching | Low CPU and DB load | Smaller HTML size | Normal | [OK] Good |