News for hackers. Stuff that matters.
Re:Towards Principled Reactive UI by raphlinus on Sunday September 27, 2020 @01:08AM (#24604367)
What you're saying seems to be consistent with what I'm saying. Web-browser standard DOM is slow, for exactly the reasons you state. Adding an additional tree mutation API, not supported by any web browser, can obviously be a lot faster, and as you say, a good way to make that faster is to group the mutation into a transaction, rather than effectively have one transaction for each appendChild and setAttribute call.

What you've done is a pretty small change to the DOM and generally compatible with it. What I've done in Crochet is a more radical rework, but certainly with some of the same general principles (my `Mutation` datatype is also a transaction). I should also point out that my tree mutation is a bit more limited, as it can't do general movement of subtrees, only sibling movement within the same parent (and, in the current prototype, no swapping, only order-preserving, which includes insert, delete, and update).

If some compatibility with browser DOM is a goal, then your approach is appealing. I'm not pursuing it in my prototype because I'm also holding overall system simplicity as a whole. But in any case, I agree that people should be aware of what Sciter does; it's an impressive system.

Re:Towards Principled Reactive UI by c-smile on Sunday September 27, 2020 @09:43AM (#24606557)
We just need to add one method to Web API:

    document.mutate(function(mutator) {
      mutator.changeAttributes(el,{...});
      mutator.appendNodes(el,...);
    ...    
  });
The mutate will do transactional update as fast as possible.