15 comments

  • kvakvs38 days ago
    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?
    • ffsm837 days ago
      I believe he stated in the beginning pretty clearly that the point of this exercise was to stress test the Liveview performance.<p>Making this more efficient would be kinda counter productive
      • jasonjmcghee37 days ago
        I agree, but it certainly wasn&#x27;t performant (in the video).<p>I&#x27;d be curious to see what parameters are required for a smooth &#x2F; playable demo.<p>Or am I missing something?<p>(Slow input with no interpolation?)
        • andros37 days ago
          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
      • omoikane37 days ago
        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.
      • andros37 days ago
        That is!
    • Jare37 days ago
      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 &quot;Jacob Seidelin&quot; who was very active experimenting with early HTML5 tech, but I&#x27;ve lost all links or they&#x27;ve vanished from the web - I only keep two screenshots I used in a lecture back then.
    • oersted37 days ago
      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.
      • andros37 days ago
        If it&#x27;s streaming at 60 fps, the bottleneck is in the browser, which is doing what it can :)
        • maccard37 days ago
          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.
    • dentalnanobot37 days ago
      Wonder if it would be more efficient to use a single-pixel column and then draw the colours with gradient stops?
  • rockyj37 days ago
    Very impressive! Worth noting that HTMX also has a WebSocket extension - <a href="https:&#x2F;&#x2F;v1.htmx.org&#x2F;extensions&#x2F;web-sockets&#x2F;" rel="nofollow">https:&#x2F;&#x2F;v1.htmx.org&#x2F;extensions&#x2F;web-sockets&#x2F;</a> so one could potentially also do &quot;live views&quot; in more performant runtimes like JVM or Node.js
    • andros37 days ago
      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.
      • BiteCode_dev37 days ago
        Can you tell us more? Espacially, how does they both fair with auth.
        • andros37 days ago
          There is native middleware in Channels. I have it documented with a brief example in the documentation, and I also mention some security measures.
  • andypants37 days ago
    This is more like HTMX+websockets than phoenix liveview.<p><pre><code> - It&#x27;s not stateful - There&#x27;s no html diffing - Handlers return target+fragment instead of updating state</code></pre>
    • andros37 days ago
      Each user has their ID in the backend; you can save their status... if you want.
  • scop37 days ago
    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.
    • andros37 days ago
      There are two things I&#x27;m really bad at: invalidating the cache and naming frameworks. It has that name because it&#x27;s very inspired. It&#x27;s an adaptation of Django.
      • elzbardico37 days ago
        And well done! I really prefer very descriptive names, even at the expense of originality than some ridiculous invention like &quot;Nano Banana&quot;.
        • ameliaquining37 days ago
          IIUC the &quot;Nano Banana&quot; 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&#x27;t originally intended to keep using it after the announcement, but it unexpectedly took off among users.
  • crimsonnoodle5837 days ago
    So SSR is 50ms and LiveView is 10ms, what test was being performed to achieve these timings? Rendering a sample page or rendering doom?<p>Also LiveView is described as &quot;Build rich, dynamic user experiences with server-rendered HTML without writing a single line of JavaScript.&quot; and their example uses django templating to render the HTML that is returned.<p>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?
    • aeonfox37 days ago
      I assume Django LiveView is directly inspired by Phoenix LiveView. It&#x27;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.
      • andros37 days ago
        The concept is correct, but it&#x27;s a bit simpler Its architecture is explained in the documentation, that&#x27;s why it&#x27;s so fast!
        • zie37 days ago
          I looked(admittedly briefly) and couldn&#x27;t find the architecture explanation in the docs here: <a href="https:&#x2F;&#x2F;django-liveview.andros.dev&#x2F;docs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;django-liveview.andros.dev&#x2F;docs&#x2F;</a>
          • andros37 days ago
            I apologize, I assumed the architecture would be understandable from the examples. I&#x27;ll keep that in mind!
            • aeonfox37 days ago
              The docs lead to a 403, but I&#x27;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?
              • zie37 days ago
                sorry, try this: <a href="https:&#x2F;&#x2F;django-liveview.andros.dev&#x2F;docs&#x2F;install&#x2F;" rel="nofollow">https:&#x2F;&#x2F;django-liveview.andros.dev&#x2F;docs&#x2F;install&#x2F;</a><p>Though it doesn&#x27;t answer your question, the link at least works :)
  • ksec41 days ago
    In the blog post it uses &quot;600,000 divs&#x2F;second!&quot; and &quot;10,000 divs using its template engine&quot; while the heading uses 600.000.<p>I assume the difference in usage of full stop &#x2F; period or comma is accidental?
    • andros41 days ago
      Yes, you right hehe. I had fixed!
  • hoistbypetard37 days ago
    That is beautifully ridiculous! Thank you for doing that and sharing.
    • andros37 days ago
      Thank you for this comment :)
  • lukevp37 days ago
    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?
  • agentifysh38 days ago
    if only i could run django on cloudflare workers<p>guess i could run it on a dedicated server<p>would be nice if we can get django and liveview working without a server
    • evilmonkey1938 days ago
      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.
      • yoavm37 days ago
        Cloudflare D1 is SQLite within Cloudflare.
      • BiteCode_dev37 days ago
        Why, because it&#x27;s free?
    • isodev37 days ago
      Bunny has very solid edge runtime if you manage to squeeze it into wasm or “magic containers” so it’s just a pod<p><a href="https:&#x2F;&#x2F;bunny.net&#x2F;cdn-lp" rel="nofollow">https:&#x2F;&#x2F;bunny.net&#x2F;cdn-lp</a>
    • fulafel37 days ago
      They just announced many improvements to Python workers earlier this month: <a href="https:&#x2F;&#x2F;blog.cloudflare.com&#x2F;python-workers-advancements&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.cloudflare.com&#x2F;python-workers-advancements&#x2F;</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;G4brym&#x2F;django-cf" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;G4brym&#x2F;django-cf</a> has a template (among other things) to get started<p>Another option is the containers stuff mentioned in sibling comment but it&#x27;s not so FaaS.
    • slig37 days ago
      Should be possible with this, no?<p><a href="https:&#x2F;&#x2F;developers.cloudflare.com&#x2F;containers&#x2F;" rel="nofollow">https:&#x2F;&#x2F;developers.cloudflare.com&#x2F;containers&#x2F;</a>
    • leobuskin38 days ago
      you can do it on wasmer&#x27;s workers, their last wasm&#x2F;python approach is pretty solid (compatibility, performance). it&#x27;s sad to say, but after 4 years of &quot;beta&quot; Python support on CF workers - it&#x27;s still ugly. I dunno who was responsible for such a neglect, but even with the last changes - total fiasco
      • gscho37 days ago
        Why is it “ugly”?
    • _boffin_37 days ago
      We ran Django on AWS Lambas years ago. Wasn’t fun and caused headaches, but worked
  • pawelduda38 days ago
    Shame Phoenix LiveView is missing from the comparison
    • leobuskin38 days ago
      It&#x27;s only django-related third-party packages comparison (and SSR itself), would be a bit strange to compare with a different language&#x2F;stack and&#x2F;or framework
      • isodev37 days ago
        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
        • true_religion37 days ago
          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.
      • pawelduda36 days ago
        If it&#x27;s only about Django ecosystem, true that. But if it&#x27;s about pushing the limits how fast you can server-side render doom, then there are more possibilities to be tested:)
  • tomcam37 days ago
    Doesn&#x27;t this also show that HTML&#x2F;CSS performance is incredibly good on web browsers these days?
  • elzbardico37 days ago
    This shows how modern hardware is ridiculously powerful.
  • pallar37 days ago
    &gt; 600.000 divs&#x2F;segundo<p>Basado
  • jkhall8137 days ago
    When will people stop doing this and just leave Doom alone?