Comment by halflife

5 months ago

Don’t know if it’s related to the article, but the chats ui performance becomes absolutely horrendous in long chats.

Typing the chat box is slow, rendering lags and sometimes gets stuck altogether.

I have a research chat that I have to think twice before messaging because the performance is so bad.

Running on iPhone 16 safari, and MacBook Pro m3 chrome.

In the good old days Netflix had "Dynamic HTML" code that would take a DOM element which scrolled out of view port and move it to the position where it was about to be scrolled in from the other end. Hence he number of DOM elements stayed constant no matter how far you scroll and the only thing that grows is the Y coordinate.

They did it because a lot of devices running Netflix (TVs, DVD players, etc) were underpowered and Netflix was not keen on writing separate applications. They did, however, invest into a browser engine that would have HW acceleration not just for video playback but also for moving DOM elements. Basically, sprites.

The lost art of writing efficient code...

  • > Hence he number of DOM elements stayed constant no matter how far you scroll and the only thing that grows is the Y coordinate.

    This is generally called virtual scrolling, and it is not only an option in many common table libraries, but there are plenty of standalone implementations and other libraries (lists and things) that offer it. The technique certainly didn't originate with Netflix.

    • Yes, tables and lists, since they have a fixed height per item/row. Chat messages don't have a fixed height so its more difficult. And by more difficult I mean that every single virtual paging library that I've looked at in the past would not work.

      4 replies →

    • Its been about three years but infinite scroll is naunced depending on the content that needs to be displayed. Its a tough nut to crack and can require a lot of maintenance to keep stable.

      None of which chatgpt can handle presumably.

    • And yet ChatGPT does not use it.

      GP was mentioning that a solution to the problem exists, not that Netflix specifically invented it. Your quip that the technique is not specific to Netflix bolsters the argument that OpenAI should code that in.

      3 replies →

  • This is how every scrolling list has been implemented since the 80s. We actually lost knowledge about how to build UI in the move to web

    • The biggest issue is that there is no native component support for that. So everyone implements their own and it is both brittle and introduces some issues like:

      - "ctrl + f" search stops working as expected - the scrollbar has wrong dimensions - sometimes the content might jump (common web issue overall)

      The reason why we lost it is because web supports wildly different types of layouts, so it is really hard to optimize the same way it is possible in native apps (they are much less flexible overall).

      3 replies →

Almost certainly running some sort of O(n^2) algorithm on the chat text every key press. Or maybe just insane hierarchies of HTML.

Either way, pretty wild that you can have billions of dollars at your disposal, your interface is almost purely text, and still manage to be a fuckup at displaying it without performance problems.

OpenAI sites are the only ones that do this to me. I have to keep a separate browser profile just for my OpenAI login with absolutely nothing installed on it or it'll end up being dogshit slow and unusable.

Yeah just had this earlier today, I had to write my response in vscode and paste it in, there were literal seconds of lag for typing each character. Typical bloated React.

  • Just because a web application uses React and is slow, it does not follow that it is slow because of React.

    It's perfectly possible to write fast or slow web applications in React, same as any other framework.

    Linear is one of the snappiest web applications I've ever used, and it is written in React.

    • Sure it's possible but those are a handful of exceptions against the norm, when the general approach so easily guides you towards bloat upon bloat that you have to be an expert to actively avoid going down that route.