4 ms·
Doom in Django: testing the limits of LiveView at 600.000 divs/segundo
- ksec 10mo agoIn 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?
- andros 10mo agoYes, you right hehe. I had fixed!
- agentifysh 10mo agoif 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
- leobuskin 10mo agoyou 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
- gscho 10mo agoWhy is it “ugly”?
- evilmonkey19 10mo agoI 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.
- yoavm 10mo agoCloudflare D1 is SQLite within Cloudflare.
- BiteCode_dev 10mo agoWhy, because it's free?
- isodev 10mo agoBunny 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 https://bunny.net/cdn-lp
- slig 10mo agoShould be possible with this, no? https://developers.cloudflare.com/containers/ https://developers.cloudflare.com/containers/
- fulafel 10mo agoThey just announced many improvements to Python workers earlier this month: https://blog.cloudflare.com/python-workers-advancements/ https://blog.cloudflare.com/python-workers-advancements/ https://github.com/G4brym/django-cf https://github.com/G4brym/django-cf has a template (among other things) to get started Another option is the containers stuff mentioned in sibling comment but it's not so FaaS.
- _boffin_ 10mo agoWe ran Django on AWS Lambas years ago. Wasn’t fun and caused headaches, but worked
- pawelduda 10mo agoShame Phoenix LiveView is missing from the comparison
- leobuskin 10mo agoIt'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
- isodev 10mo agoWith 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
- true_religion 10mo agoSix 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.
- pawelduda 10mo agoIf 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:)
- kvakvs 10mo agoSince 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?
- ffsm8 10mo agoI 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
- jasonjmcghee 10mo agoI 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?)
- andros 10mo agoTo 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
- andros 10mo agoThat is!
- omoikane 10mo agoI 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.
- 10mo ago
- rockyj 10mo agoVery impressive! Worth noting that HTMX also has a WebSocket extension - https://v1.htmx.org/extensions/web-sockets/ https://v1.htmx.org/extensions/web-sockets/ so one could potentially also do "live views" in more performant runtimes like JVM or Node.js
- andros 10mo agoMy first version of Django LiveView used HTMX. WebSocket connectivity is one aspect; there is another part of logic and architecture where it falls short.
- BiteCode_dev 10mo agoCan you tell us more? Espacially, how does they both fair with auth.
- andros 10mo agoThere is native middleware in Channels. I have it documented with a brief example in the documentation, and I also mention some security measures.
- crimsonnoodle58 10mo agoSo 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?
- aeonfox 10mo agoI 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.
- andros 10mo agoThe concept is correct, but it's a bit simpler Its architecture is explained in the documentation, that's why it's so fast!
- zie 10mo agoI looked(admittedly briefly) and couldn't find the architecture explanation in the docs here: https://django-liveview.andros.dev/docs/ https://django-liveview.andros.dev/docs/
- scop 10mo agoTangential 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.
- andros 10mo agoThere 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.
- elzbardico 10mo agoAnd well done! I really prefer very descriptive names, even at the expense of originality than some ridiculous invention like "Nano Banana".
- ameliaquining 10mo agoIIUC 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.
- pallar 10mo ago> 600.000 divs/segundo Basado
- hoistbypetard 10mo agoThat is beautifully ridiculous! Thank you for doing that and sharing.
- andros 10mo agoThank you for this comment :)
- lukevp 10mo agoIt 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?
- elzbardico 10mo agoThis shows how modern hardware is ridiculously powerful.
- deleted 10mo ago[deleted]
- andypants 10mo agoThis 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
- andros 10mo agoEach user has their ID in the backend; you can save their status... if you want.
- jkhall81 10mo agoWhen will people stop doing this and just leave Doom alone?
- pak9rabid 10mo agoNever I hope
- tomcam 10mo agoDoesn't this also show that HTML/CSS performance is incredibly good on web browsers these days?