Performance: Task results and status
MEDIUM IMPACT
This concept affects how quickly users see task completion feedback and how efficiently the server handles background task updates.
def start_task_view(request): task = background_task.delay() return JsonResponse({'task_id': task.id, 'status': 'started'}) # Frontend polls or uses WebSocket to get status updates asynchronously
def task_view(request): result = long_running_task() return JsonResponse({'status': 'done', 'result': result})
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous task execution in request | Minimal DOM changes | 0 reflows during task but blocks response | Delayed paint due to blocking | [X] Bad |
| Asynchronous task with polling or WebSocket | Incremental DOM updates on status change | 1 reflow per update | Smooth paint with small incremental changes | [OK] Good |