alt.hn

12/28/2025 at 8:10:01 AM

Doom in Django: testing the limits of LiveView at 600.000 divs/segundo

https://en.andros.dev/blog/7b1b607b/doom-in-django-testing-the-limits-of-liveview-at-600000-divssegundo/

by andros

12/31/2025 at 11:49:32 AM

Since Doom renders the image with vertical columns of pixels (floor, lower wall, portal if exists continues rendering the other sector, then upper wall then ceiling) and since browsers are very good at drawing the sprites out of larger textures... You could send vertical divs shaded with the sector light level and picking the correct textures. Instead of hundreds per column you will have like 5 divs on average per column and they will be textured shaded and scaled by the browser?

by kvakvs

12/31/2025 at 1:16:33 PM

I believe he stated in the beginning pretty clearly that the point of this exercise was to stress test the Liveview performance.

Making this more efficient would be kinda counter productive

by ffsm8

12/31/2025 at 2:04:49 PM

I agree, but it certainly wasn't performant (in the video).

I'd be curious to see what parameters are required for a smooth / playable demo.

Or am I missing something?

(Slow input with no interpolation?)

by jasonjmcghee

12/31/2025 at 2:42:31 PM

To improve fluidity, all you have to do is change the frames per second or the resolution, although the goal is not to make it playable. :D

by andros

12/31/2025 at 6:17:39 PM

I think the proposal here is to optimize for bandwidth by minimizing number of divs, because there are fewer divs per column per frame. It might actually turn out to be more work for the browser because it has to layout the columns with divs that are not uniformly sized.

by omoikane

12/31/2025 at 2:49:27 PM

That is!

by andros

12/31/2025 at 6:23:45 PM

IIRC someone did exactly that around 15 years ago, a game renderer using div strips, first with Wolfenstein and then Doom. It may have been "Jacob Seidelin" who was very active experimenting with early HTML5 tech, but I've lost all links or they've vanished from the web - I only keep two screenshots I used in a lecture back then.

by Jare

1/1/2026 at 4:57:59 AM

Wonder if it would be more efficient to use a single-pixel column and then draw the colours with gradient stops?

by dentalnanobot

12/31/2025 at 2:46:19 PM

At that point just run the browser on the server and use proper cloud gaming tech to stream the screen and have low-latency interactivity.

by oersted

12/31/2025 at 3:31:32 PM

If it's streaming at 60 fps, the bottleneck is in the browser, which is doing what it can :)

by andros

12/31/2025 at 7:20:42 PM

My phone and TV can go to 120hz, and my PC can go to 240 with adaptive sync. There’s still plenty of room to improve.

by maccard

12/31/2025 at 6:31:03 PM

This is more like HTMX+websockets than phoenix liveview.

  - It's not stateful
  - There's no html diffing
  - Handlers return target+fragment instead of updating state

by andypants

12/31/2025 at 8:50:00 PM

Each user has their ID in the backend; you can save their status... if you want.

by andros

12/31/2025 at 12:25:53 PM

Very impressive! Worth noting that HTMX also has a WebSocket extension - https://v1.htmx.org/extensions/web-sockets/ so one could potentially also do "live views" in more performant runtimes like JVM or Node.js

by rockyj

12/31/2025 at 2:45:48 PM

My first version of Django LiveView used HTMX. WebSocket connectivity is one aspect; there is another part of logic and architecture where it falls short.

by andros

12/31/2025 at 3:15:21 PM

Can you tell us more? Espacially, how does they both fair with auth.

by BiteCode_dev

12/31/2025 at 3:34:17 PM

There is native middleware in Channels. I have it documented with a brief example in the documentation, and I also mention some security measures.

by andros

12/31/2025 at 1:40:10 PM

So SSR is 50ms and LiveView is 10ms, what test was being performed to achieve these timings? Rendering a sample page or rendering doom?

Also LiveView is described as "Build rich, dynamic user experiences with server-rendered HTML without writing a single line of JavaScript." and their example uses django templating to render the HTML that is returned.

So what are we really measuring here? The speed up seems to solely come from WebSockets, and maybe skipping some Django middleware. Anyone care to elaborate?

by crimsonnoodle58

12/31/2025 at 1:57:22 PM

I assume Django LiveView is directly inspired by Phoenix LiveView. It's essentially diffing template expansion on the backend and sending patches to the frontend via websockets where JS then applies the patches. Clicks and other interactions are also transmitted to the backend where state for the socket is updated and the template is reevaluated, hence completing the loop.

by aeonfox

12/31/2025 at 2:24:05 PM

The concept is correct, but it's a bit simpler Its architecture is explained in the documentation, that's why it's so fast!

by andros

12/31/2025 at 3:35:05 PM

I looked(admittedly briefly) and couldn't find the architecture explanation in the docs here: https://django-liveview.andros.dev/docs/

by zie

12/31/2025 at 5:32:32 PM

I apologize, I assumed the architecture would be understandable from the examples. I'll keep that in mind!

by andros

1/1/2026 at 1:56:22 AM

The docs lead to a 403, but I'd be curious to know how it is simpler. I believe the Phoenix version uses Erlang iolists and immutability to make diffing more efficient, and perhaps the Django version has something similar?

by aeonfox

12/31/2025 at 2:59:18 PM

That is beautifully ridiculous! Thank you for doing that and sharing.

by hoistbypetard

12/31/2025 at 5:29:45 PM

Thank you for this comment :)

by andros

12/28/2025 at 8:43:11 AM

In the blog post it uses "600,000 divs/second!" and "10,000 divs using its template engine" while the heading uses 600.000.

I assume the difference in usage of full stop / period or comma is accidental?

by ksec

12/28/2025 at 9:05:29 AM

Yes, you right hehe. I had fixed!

by andros

12/31/2025 at 3:15:21 PM

It definitely isn’t running at 60 fps in the video. Is this css performance or something? Or this not really running as fast as it’s stated?

by lukevp

12/31/2025 at 10:33:40 AM

if only i could run django on cloudflare workers

guess i could run it on a dedicated server

would be nice if we can get django and liveview working without a server

by agentifysh

12/31/2025 at 12:05:17 PM

I wish we could host Django apps with the tasks and everything on Cloudflare workers. Also it would be nice to have a DB like SQLite within Cloudflare.

by evilmonkey19

12/31/2025 at 1:13:10 PM

Cloudflare D1 is SQLite within Cloudflare.

by yoavm

12/31/2025 at 2:12:27 PM

Why, because it's free?

by BiteCode_dev

12/31/2025 at 12:44:12 PM

Bunny has very solid edge runtime if you manage to squeeze it into wasm or “magic containers” so it’s just a pod

https://bunny.net/cdn-lp

by isodev

12/31/2025 at 10:58:18 AM

you can do it on wasmer's workers, their last wasm/python approach is pretty solid (compatibility, performance). it's sad to say, but after 4 years of "beta" Python support on CF workers - it's still ugly. I dunno who was responsible for such a neglect, but even with the last changes - total fiasco

by leobuskin

12/31/2025 at 2:16:55 PM

Why is it “ugly”?

by gscho

12/31/2025 at 6:11:04 PM

We ran Django on AWS Lambas years ago. Wasn’t fun and caused headaches, but worked

by _boffin_

12/31/2025 at 11:32:49 PM

Doesn't this also show that HTML/CSS performance is incredibly good on web browsers these days?

by tomcam

12/31/2025 at 2:38:47 PM

Tangential question: is it common for frameworks to use the same name as a package from another framework? I had never heard of Django LiveView, but have used Phoenix’s Liveview and assumed that’s what it was. Not sure if I like that? I.e. does it imply some sort of endorsement or partnership? I do like that Laravel went with Livewire to distinguish it.

by scop

12/31/2025 at 2:47:58 PM

There are two things I'm really bad at: invalidating the cache and naming frameworks. It has that name because it's very inspired. It's an adaptation of Django.

by andros

12/31/2025 at 5:13:19 PM

And well done! I really prefer very descriptive names, even at the expense of originality than some ridiculous invention like "Nano Banana".

by elzbardico

12/31/2025 at 5:45:50 PM

IIUC the "Nano Banana" name was originally used on LMArena when the model had not yet been announced; the purpose of the name was therefore to be as opaque as possible. I assume they hadn't originally intended to keep using it after the announcement, but it unexpectedly took off among users.

by ameliaquining

12/31/2025 at 10:45:17 AM

Shame Phoenix LiveView is missing from the comparison

by pawelduda

12/31/2025 at 10:55:14 AM

It's only django-related third-party packages comparison (and SSR itself), would be a bit strange to compare with a different language/stack and/or framework

by leobuskin

12/31/2025 at 12:46:36 PM

With focus on LiveView, I think it’s interesting to see how the runtime influences the results. Django and Phoenix have a very different concurrency model

by isodev

1/1/2026 at 2:39:28 AM

Six years ago when I was working with a Phoenix API, we were measuring responses in microseconds on local dev machines, and under 5 ms in production with zero optimization. In comparison the identical Django app had a 50 ms floor.

by true_religion

1/1/2026 at 5:17:06 PM

If it's only about Django ecosystem, true that. But if it's about pushing the limits how fast you can server-side render doom, then there are more possibilities to be tested:)

by pawelduda

12/31/2025 at 5:11:44 PM

This shows how modern hardware is ridiculously powerful.

by elzbardico

12/31/2025 at 2:40:08 PM

> 600.000 divs/segundo

Basado

by pallar

12/31/2025 at 6:39:18 PM

When will people stop doing this and just leave Doom alone?

by jkhall81

12/31/2025 at 7:14:35 PM

Never I hope

by pak9rabid