Performance comparison of Django's main interactive frameworks
Which Django interactive framework is actually the fastest? LiveView, HTMX, Unicorn, Reactor, or good old server-side rendering? I don't know, but I'd like to find out. Is investing time in WebSockets a waste? Is hmtx slow? So many questions to answer.
The results were... surprising.
Technology Comparison
First, a quick overview of the technologies compared:
| Feature | LiveView | SSR | django-htmx | Unicorn | Reactor |
|---|---|---|---|---|---|
| Transport | WebSocket | HTTP | AJAX | AJAX | WebSocket |
| Update Type | Real-time | Full reload | Partial | Reactive | Real-time |
| Multi-user | ✅ Broadcast | ❌ | ❌ | ❌ | ✅ Broadcast |
| Infrastructure | Redis + Channels | Django only | Django only | Django only | Redis + Channels |
Performance Testing
To settle this question, I built an identical alert management system using each framework. The test workflow: click a button that creates a database record, wait for it to render on the page, navigate to a form (page/modal), intentionally fail validation, see error messages, submit correctly, return to the previous screen, and verify the new element appears. Pretty easy and common workflow.
Each framework was tested 10 times using Chrome DevTools Performance API, measuring:
- Response time: From button click to UI update
- Network requests: HTTP calls or WebSocket messages
- Data transfer: Bytes sent over the wire
Fair and square. Same system, same test, same browser.
Results Summary
| Implementation | Avg Response Time | Network Requests | Data Transfer | Technology |
|---|---|---|---|---|
| LiveView | 9.35ms | 0 (WebSocket) | 0.44 KB | WebSocket messages |
| Reactor | 12.00ms | 0 (WebSocket) | 0.51 KB | WebSocket components |
| django-htmx | 16.48ms | 1 HTTP request | 36.13 KB | AJAX partial HTML |
| Unicorn | 26.76ms | 1 HTTP request | 69.34 KB | AJAX component sync |
| SSR | 47.25ms | 2 HTTP requests | 8.30 KB | POST + redirect GET |
Performance Visualizations
All charts indicate that lower values are better for optimal performance.
Response Time Comparison
/https://andros.dev/media/blog/2025/12/benchmark-response-time.png)
Average response times across implementations. LiveView (9.35ms) is fastest, followed by Reactor (12.00ms), django-htmx (16.48ms), Unicorn (26.76ms), and SSR (47.25ms).
HTTP Requests per Action
/https://andros.dev/media/blog/2025/12/benchmark-network-requests.png)
Number of HTTP requests required per action. LiveView and Reactor use 0 HTTP requests (WebSocket), while SSR requires 2 (POST + redirect).
Data Transfer Overhead
/https://andros.dev/media/blog/2025/12/benchmark-data-transfer.png)
Amount of data transferred per action. LiveView (0.44 KB) and Reactor (0.51 KB) transfer minimal data, while Unicorn transfers the most (69 KB).
Performance Stability
/https://andros.dev/media/blog/2025/12/benchmark-stability.png)
Response time consistency across 10 iterations. Lower and flatter lines indicate better, more stable performance.
Key Findings
🏆 Speed Winner: LiveView (9.35ms)
- WebSocket communication eliminates HTTP overhead
- Real-time bidirectional connection already established
- Minimal data transfer (0.44 KB per action)
- Best for: Real-time dashboards, collaborative apps, maximum performance
🥈 Runner-up: Reactor (12.00ms)
- Phoenix LiveView-style architecture with WebSocket
- Component-based approach with excellent speed
- Only 28% slower than LiveView, 4x faster than SSR
- Best for: Structured components with near-LiveView performance
🥉 Third Place: django-htmx (16.48ms)
- Best AJAX solution, 38% faster than Unicorn
- Efficient partial updates, minimal JavaScript
- Good balance of speed and simplicity
- Best for: Modern UX without WebSockets
4️⃣ Fourth Place: Unicorn (26.76ms)
- Component-based with two-way data binding
- Full component state synchronization
- Larger payloads (69 KB) due to component data
- Best for: Interactive forms with complex state management
5️⃣ Traditional: SSR (47.25ms)
- Full page reload with complete render cycle
- Two HTTP requests (POST + redirect GET)
- Slowest but simplest infrastructure
- Best for: SEO-critical pages, simple CRUD apps
Conclusions
- WebSocket Dominance: Both LiveView (9.35ms) and Reactor (12.00ms) outperform HTTP-based solutions by 43-80%, with zero HTTP requests per action.
- Reactor vs LiveView: Reactor is 28% slower than LiveView but offers Phoenix LiveView-style components. Both transfer minimal data (0.44-0.51 KB) compared to AJAX solutions.
- Best AJAX Solution: django-htmx (16.48ms) is 38% faster than Unicorn (26.76ms), proving that simpler approaches often win in the AJAX category.
- Component Overhead: Unicorn's full state sync adds significant overhead (69 KB vs django-htmx's 36 KB), trading bandwidth for richer interactivity.
- Network Efficiency: WebSocket solutions (LiveView, Reactor) transfer 70-157x less data than AJAX solutions, demonstrating superior efficiency.
- Stability: WebSocket implementations show excellent consistency (std dev <1.2ms) while all frameworks maintain stable performance across iterations.
In summary, if maximum speed and efficiency are your goals, WebSocket-based frameworks like LiveView and Reactor are the clear winners. For those seeking a balance of speed and simplicity without WebSockets, django-htmx and Unicorn is a strong contender. If you prioritize simplicity and SEO, traditional SSR remains a viable option despite its slower performance.
- Technology Comparison
- Performance Testing
- Results Summary
- Performance Visualizations
- Response Time Comparison
- HTTP Requests per Action
- Data Transfer Overhead
- Performance Stability
- Key Findings
- Conclusions
This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.