logoalt Hacker News

prewetttoday at 2:45 AM5 repliesview on HN

A cogent article. But I think the biggest problem is that the DOM was built for documents, not apps. We know how to build a performant UI architecture: Qt, Java/Swing, Cocoa all have pretty similar architectures and they all ran fine on much poorer hardware than a modern browser on an M1. But unless you use WebAssembly, you can't actually use them on the browser.

When the industry shoehorns something into a tool designed for something else, yeah, performance suffers and you get a lot of framework churn with people trying to figure out how to elegantly cut steaks with spoons.


Replies

saidinesh5today at 3:24 AM

While I don't have the performance bottleneck numbers of React, I don't think it's about Javascript vs. WASM here.

I've seen/built some large Qt/QML applications with so much javascript and they all performed much better than your average React webapp. In fact the V8 / other browser Javascript engines also have JIT while the QML engine didn't.

Comparing QtQuick/QML + JS to HTML + JS - both GPU accelerated scenegraphs, you should get similar performance in both. But in reality it is rarely the case. I suspect it might be the whole document oriented text layout and css rules, along with React using a virtual DOM and a lot of other dependencies to give us an abstraction layer.

I'd love to know more about this from someone who did an in depth profiling of the same/similar apps on something like QtQuick vs. React.

show 1 reply
carshodevtoday at 4:30 AM

But most apps are documents, they are built to render data and text fields in a nice way for the consumer to use.

You most certainly shouldn't be building graphs with table elements but JS has canvas and svg which make vectors pretty efficient to render.

The document model provides good accessibility and the ability for things like SEO and GEO to exist.

If you are making a racing simulator, then using HTML in no way makes sense, but for the apps that most of us use documents make sense.

It would be nice if browsers implemented a new interpreted statically typed language with direct canvas/viewport rendering that was more efficient than javascript, but chrome would need to adopt it, then developers would need to actually build things with it. It seems like it would currently have to come from within the chrome team directly and they are the only ones that can control something like this.

show 1 reply
wiseowisetoday at 10:44 AM

> Java/Swing

> performant UI architecture

Not sure if it’s a joke or something.

crazygringotoday at 4:49 AM

> the biggest problem is that the DOM was built for documents, not apps

I don't see the difference. They're both text and graphics laid out in a variable-sized nested containers.

And apps today make use all the same fancy stuff documents do. Fonts, vector icons, graphics, rounded corners, multilingual text including RTL, drop shadows, layers, transparency, and so forth.

Maybe you think they shouldn't. But they do. Of all the problems with apps in web pages, the DOM feels like the least of it.

nine_ktoday at 3:21 AM

It very possible to make lightning-fast React web UIs. DOM sucks, but modern computers are insanely fast, and browsers, insanely optimized. It is also very possible to make sluggish-feeling Qt or Swing applications; I've seen a number.

It mostly takes some thinking about immediate reaction, about "negligibly short" operations introducing non-negligible, noticeable delays. Anything not related to rendering should be made async, and even that should be made as fast as possible. This is to say nothing of avoiding reflows, repeated redraws, etc.

In short, sloppy GUI code feels sluggish, no matter what tools you use.

show 6 replies