Performance: Request parsing and response rendering
MEDIUM IMPACT
This concept affects server response time and how quickly the browser receives and renders content.
from django.shortcuts import render def view(request): context = request.GET.dict() return render(request, 'template.html', context)
def view(request): data = request.GET context = {} for key in data: context[key] = data[key] html = render_to_string('template.html', context) return HttpResponse(html)
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Manual request parsing + string rendering | N/A (server-side) | N/A | N/A | [X] Bad |
| Django render shortcut with context dict | N/A (server-side) | N/A | N/A | [OK] Good |