ryansolid / dom-expressions

A Fine-Grained Runtime for Performant DOM Rendering
MIT License
858 stars 125 forks source link

Reduce codegen size for dynamic expressions #276

Closed intrnl closed 9 months ago

intrnl commented 11 months ago

This pull request attempts to reduce the size of the code emitted from merging the dynamic expressions together into one effect.

ryansolid commented 11 months ago

This is interesting. I want to put something out there so you know what we've been thinking about with Solid 2.0's reactivity.

We want to change the renderEffects to split the pure from the side effectful. Ie..

createRenderEffect(() => /*pull out values, tracking*/, (values, prev) => /*non-tracking, diff & apply changes*/)

The reason is so we can run the front half as many times as we need to (considering things like async, Suspense, Transitions) and then when everything is good to render we run the second half with the most recent values, and the prev from when the second half last ran.

This still needs to be benchmarked, proven but we were thinking we'd compile existing effects into this form. One benefit is that we wouldn't need to return prev, as we'd have it. We'd still be generating a bit more code as we'd be creating the array/object that gets passed to the second function.

Anyway.. just wanted to put that out there.

intrnl commented 9 months ago

Closing in favor of #296