Re: [whatwg/dom] Atomic move operation for element reparenting & reordering (Issue #1255)

From https://github.com/whatwg/dom/issues/1255#issuecomment-2493840206:

> To be blunt, with this API as-is I think it's likely the following will happen:
> [...]
> 3. these checks will be needed in hot paths potentially affecting performance tests on which frameworks compete
> 4. if there is measurable performance degradation, frameworks will not use this API
> 
> Assuming (4) occurs, which I think is probably likely, If these checks can be done faster in platform code, they should be done there.

This isn't entirely hypothetical, but impact would be mostly limited to large structural tree updates, where most the time is really spent recomputing layout and updating paint.

In creating https://github.com/MithrilJS/mithril.js/pull/2982, flattening a nested try/catch in the attribute update flow saved about 10% in performance, and their mere addition to that section caused a roughly 20% perf drop, but only in the fast case of no attributes changed (where diffs are commonly few-millisecond). In the slow case where attributes were frequently changing, it was barely outside margin of error, but paint times would far exceed that anyways.

This is of course in the attribute update flow, and virtual DOM frameworks have to be able to process thousands, possibly tens of thousands, of these in just a single frame. In some cases, skipping even one frame with those updates would result in noticeable perf degradation. (Some users use Mithril.js to power games, and so they'd need that kind of speed.) Conversely, a keyed list might have to move hundreds if you change sort order, and users would tolerate *some* noticeable lag. So, as long as it clocks in at no more than about 10us per operation for the whole try/catch, my only complaint would be just the need for that try/catch.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/1255#issuecomment-2495848043
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/1255/2495848043@github.com>

Received on Sunday, 24 November 2024 07:13:33 UTC