News for hackers. Stuff that matters.
Re:Virtual DOM is pure overhead (2018) by aidenn0 on Tuesday June 29, 2021 @11:45AM (#27677554)
I wrote a react application and VDOM overhead was so high that I had to cut down what parts of the UI were rendered to just what was on-screen at any given time. Performance was just barely okay on a desktop and completely unusable on an Android phone.

Not using react made everything work amazingly fine. Granted this was an application with fairly low amounts of DOM manipulation (popup things when the user clicks on stuff, some lists that elements can be added/removed to/from), but those sorts of things seem fairly typical.

I wanted to use React because the code was so much cleaner and concise, but it was just way too slow.

Re:Virtual DOM is pure overhead (2018) by macspoofing on Tuesday June 29, 2021 @12:23PM (#27678114)
>I wanted to use React because the code was so much cleaner and concise, but it was just way too slow.

I've been hard on React in other places in this thread because I agree with the premise of the article that VDOM is not free and that the value of React is not in performance over raw DOM manipulations, but rather in code organization.

Having said that, React isn't bad either. That it was too slow for you, I suspect, comes down how you wrote and structured your application and not necessarily React. It's been a few years since I did any meaningful React development, but back when I did, React code was simple enough that it wasn't hard to understand and trace trough, or profile. I guess I'm curious, what the bottleneck was.

Re:Virtual DOM is pure overhead (2018) by aidenn0 on Tuesday June 29, 2021 @12:58PM (#27678587)
> React code was simple enough that it wasn't hard to understand and trace trough, or profile

Interestingly enough, this was the opposite of my experience. For my next project I used Mithril because it was far easier for me to debug, trace, and profile through.

> That it was too slow for you, I suspect, comes down how you wrote and structured your application and not necessarily React.

I had on the order of 100 inputs with two-way binding. My code was structured along the lines of the existing react tutorial of the day (maybe 10ish years ago?). Per suggestions of members of the react community, I restructured it to use ImmutableJS to allow for faster VDOM diffing, which did cause a noticeable speedup, but was still dog slow.

Re:Virtual DOM is pure overhead (2018) by Quinner on Tuesday June 29, 2021 @01:19PM (#27678896)
It's hard to say for certain, but it sounds as if you may have been doing things that caused lots unnecessary re-renders. React has some pitfalls for beginners, but I've built highly complex frequently updating webapps without the degree of slowness you're speaking of.
Re:Virtual DOM is pure overhead (2018) by rasz on Tuesday June 29, 2021 @10:27PM (#27684230)
Vivaldi browser is made using React. Frantic pointless UI DOM manipulations (deleting nodes just to recreate them back etc) are one of the main sources of performance degradation. https://news.ycombinator.com/item?id=27449736
Re:Virtual DOM is pure overhead (2018) by runawaybottle on Tuesday June 29, 2021 @11:04PM (#27684402)
I just read that and chuckled. Someone must have been under pressure and just said fuck it, this works.