News for hackers. Stuff that matters.
Re:Moxie: Incremental Declarative UI in Rust by Devagamster on Monday December 02, 2019 @02:12PM (#21685722)
Not really. The assumption is that modifying the dom directly is the expensive part.
Re:Moxie: Incremental Declarative UI in Rust by erikpukinskis on Monday December 02, 2019 @02:16PM (#21685766)
Doesn’t seem like a good bet for the long term. There’s no practical reason why modifying the DOM couldn’t be practically free. Especially if we can hint to the layout engine that we’re working in a well behaved subset. (Or the layout engine can detect such)
Re:Moxie: Incremental Declarative UI in Rust by Manishearth on Monday December 02, 2019 @03:58PM (#21686856)
Hi, I work on a browser, layout and styling are expensive.

Browsers already to tons of work to avoid recomputing too much of this stuff whenever the DOM changes, and it's still inadvisable to poke the DOM too much. I don't see this changing anytime soon. There are various new features that allow for some level of hinting, but it's not going to obviate this. Browsers need to have incremental layout/styling prepare for any kind of potential change, whereas if you have a reactive UI framework you know what kinds of changes can happen, and can optimize diffing based on that.

There's a reason why a lot of JS UI frameworks use a virtual DOM. It sounds expensive to maintain, but directly operating on the DOM is more expensive.

Re:Moxie: Incremental Declarative UI in Rust by erikpukinskis on Tuesday December 03, 2019 @12:36PM (#21694529)
That’s why I mentioned subsets! (like ASM.js)

Also, syncing can theoretically get to the minimum possible DOM calls, but with good tools I believe I can get close to n*log(n) of that with a procedural model. Which makes your point somewhat moot.

Re:Moxie: Incremental Declarative UI in Rust by fulafel on Tuesday December 03, 2019 @12:48AM (#21690261)
At some point the JS->C++ FFI was just slow in most browsers, but I guess this has seen improvements lately?
Re:Moxie: Incremental Declarative UI in Rust by Manishearth on Tuesday December 03, 2019 @02:09AM (#21690535)
I don't think that's too slow. It can be, but it's not the main bottleneck in my experience.

That said there are various tricks that browsers use to avoid introducing these boundaries.

Re:Moxie: Incremental Declarative UI in Rust by aassddffasdf on Monday December 02, 2019 @02:21PM (#21685813)
Right. All this treating the DOM with kid gloves seems to be due to its pre-existing weaknesses. Why not just fix those?
Re:Moxie: Incremental Declarative UI in Rust by opencl on Monday December 02, 2019 @04:50PM (#21687394)
Browser vendors have spent the past several decades trying to fix those weaknesses and haven't, it seems like a very strong indication that it is not exactly an easy thing to do.
Re:Moxie: Incremental Declarative UI in Rust by fulafel on Tuesday December 03, 2019 @12:49AM (#21690265)
This might be just because most web apps never had a bottleneck on JS->DOM changes.
Re:Moxie: Incremental Declarative UI in Rust by RussianCow on Tuesday December 03, 2019 @04:03PM (#21696678)
This is blatantly false, as the DOM has always been a bottleneck for web apps.
Re:Moxie: Incremental Declarative UI in Rust by kelnos on Monday December 02, 2019 @07:26PM (#21688657)
Because you can't "just" fix them. It's a complex problem with no easy solutions. Don't you think it'd already be "fixed" if it was easy?
Re:Moxie: Incremental Declarative UI in Rust by outworlder on Monday December 02, 2019 @07:00PM (#21688473)
> There’s no practical reason why modifying the DOM couldn’t be practically free.

Oh yeah, modifying the DOM is practically free. Which is why React and the like do that in their mirror DOM.

Actually applying the resulting changes, on the other hand...