Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

So glad to see this article, I've long wondered how this "virtual DOM is faster" myth got accepted as gospel when clearly it's pure overhead, compared to a well written app that updates the DOM directly only when needed (which I find is easy to accomplish in most apps).

Can't speak to the svelte approach due to inexperience with it, but good to see this myth challenged - react.js is fine but I worry there's been a cargo cult mentality around it, that it's The One True Modern Way To Do Web Apps, when really it's a tradeoff that involves some extra layers and performance baggage, and like any tool you need to weigh the pros and cons.



compared to a well written app that updates the DOM directly only when needed (which I find is easy to accomplish in most apps)

Do you do full blown SPAs with this technique? I mean I'm sure it's possible, but I wonder how difficult it is.

I wouldn't use (p)react for a website that just needed a bit of AJAX, but I find it a bit hard to imagine doing an actual app with vanilla JS.


React and friends made themself show up on every party. Even if the model isn't remotely appropriate for the taks at hand, you have to argue about them. I am convinced that half the modern frontend devs don't even know how a "classic" web app could work. SPAs or frameworks usually used for SPAs are the default state and there isnn't any competitive option with a real name except jquery/ajax/html. Even talking about the latter will brand you as dinosaur in many circles.


> but I wonder how difficult it is.

Its not if you have some basic understanding how the code actually works.

> but I find it a bit hard to imagine doing an actual app with vanilla JS.

Try it. It will blow your mind how simple it is and how little overhead it requires.


I went from developing simple server-rendered websites enhanced with a bit jQuery straight to React-style JS.

I'm interested in studying the source of less or more complex JS-apps, that were developed without SPA-Frameworks.

One I'd like to see would be Construct3, but alas it's not open-source.

I'd very much appreciate links and hints!


You can look at my SPA that maintains state perfectly well and persistently without any framework. It isn't hard, but you would have to be willing to write original code.

https://prettydiff.com/

All of the UI is defined here: https://github.com/prettydiff/prettydiff/blob/master/api/pre...


> compared to a well written app that updates the DOM directly only when needed (which I find is easy to accomplish in most apps).

> Can't speak to the svelte approach due to inexperience with it

Heya! I'm been using Svelte for the last week for a new project - knowing React has the lion's share of community right now, but feeling like Svelte is where things are going to be.

Regarding: "compared to a well written app that updates the DOM directly only when needed" - exactly! Svelte actually does this for you. Given the following Svelte code:

    age = 7;
That just updated anything bound to 'age' in the DOM. No set() or setState() or whatever. Or for an array:

    favoriteFoods.push('peaches');
    favoriteFoods = favoriteFoods;
That just updated the DOM for anything bound to 'favoriteFoods'.

The whole point of Svelte is that it takes your input JS, and builds the well written app as output!

It's very easy to pick up and I like it a lot.

https://svelte.dev/


Svelte definitely is compelling, but one thing I really like about using React or Vue.js are the very mature communities and in particular the full-featured styled widget libraries. Projects like Semantic UI React[1] or Buefy[2] (Bulma/Vue.js) give you so many basic components that would be major time sink to create yourself in every project. Does Svelte have anything like this?

[1] https://react.semantic-ui.com

[2] https://buefy.org/documentation


react.js is fine but I worry there's been a cargo cult mentality around it,

And also an actual personality cult directed at some key people.


tell me about it! Or, heaven forbid, just make the user get the entire html page rendered from server after every click like it's 2003 or 2004!


Which sometimes is not bad at all. Ever tried to ctrl-click an interface element (a navigation button, a menu) because you want to open its view in a new window?

A lot of (admittedly badly coded) "modern" web apps ignore basic web idioms (like hyperlinks) and assume as unique single user workflow the one its designer tought the app (and the only one he tested).


A nice example of this: with the new Reddit interface, only visible comments are rendered, so you can't use your browser search functionality to search all comments on the page, just the ones currently in the viewport.


Amen to this. The new Reddit interface is a step backwards in functionality due to this sorta stuff and effectively breaks user experience.

Just to give an idea how bad it is: loading the front page cold of new reddit = 9685KB. Loading the front page on the old reddit (also cold) = 737KB. The compute profile is literally half for old.reddit.com (new peak 16%, old peak 7.5% - both metrics core-distributed over an 8c system; 1s sample rate).

I LOVE all of this talk that front-end devs like to have on optimization/state stability. Talk to an browser automation expert, esp. one that does it at scale. Almost 100% of the time older/simpler front-end tooling/development is faster and less error prone. Older also takes a FRACTION of the compute/memory/proxy resources. It's been this way for years!!!

ducks for the inevitable storm of HN hate for having a strong opinion


Kind of like TechCrunch hijacking middle click to open the link in same page. Shoddy worksmanship.

[This has only recently been fixed to behave normally]


Yeah, you're right. But then you get others now trying to say "No no no, you have it all wrong. We didn't really say VDOM was faster. You misunderstood."


I hate this type of argument - blaming the receiver while at the same time taking no responsibility for their poor wording.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: