Coder Social home page Coder Social logo

Comments (4)

titoBouzout avatar titoBouzout commented on June 12, 2024 1

This is what we call "merged effects", instead of adding 1 effect to each prop, it adds an effect that tracks all the props. It's an optimization for avoiding having to create too many effects. You are supposed to use a memo for prop functions that you wish to not re-run.

from solid.

ryansolid avatar ryansolid commented on June 12, 2024 1

If you look there is shallow diffing taking place here not to over-update the DOM. But yes we loosened the granularity to improve creation speed. The update speed usually is trivial by comparison. Truly static props are hoisted out of the effect but both data-count and id could update so they are there (they call functions so they could be reactive). The way to think of createMemo is the cost of the execution. If you call a function and it is relatively cheap (most things) then it isn't worth wrapping. If it is wrap. This is pretty independent of how it is used.

Finally Qwik gets there grouping from having a VDOM re-render components on non-granular changes, but having granular changes be our only approach has caused this approach to evolve over the past 6 years. The truth of the matter is that purely granular overhead can be significant. This benchmark shows some of the impact as to get good granular scores it pushes you towards a more granular implementation. Especially note benchmarks around creation/removal: https://krausest.github.io/js-framework-benchmark/current.html

from solid.

phy-lei avatar phy-lei commented on June 12, 2024

This is what we call "merged effects", instead of adding 1 effect to each prop, it adds an effect that tracks all the props. It's an optimization for avoiding having to create too many effects. You are supposed to use a memo for prop functions that you wish to not re-run.

Thank you for your response. The term 'merged effects' seems to imply a difference from Qwik, where each prop is individually maintained. This appears odd to me that static props still require memoization by the user. However, I'll adhere to this rule.

from solid.

phy-lei avatar phy-lei commented on June 12, 2024

If you look there is shallow diffing taking place here not to over-update the DOM. But yes we loosened the granularity to improve creation speed. The update speed usually is trivial by comparison. Truly static props are hoisted out of the effect but both data-count and id could update so they are there (they call functions so they could be reactive). The way to think of createMemo is the cost of the execution. If you call a function and it is relatively cheap (most things) then it isn't worth wrapping. If it is wrap. This is pretty independent of how it is used.

Finally Qwik gets there grouping from having a VDOM re-render components on non-granular changes, but having granular changes be our only approach has caused this approach to evolve over the past 6 years. The truth of the matter is that purely granular overhead can be significant. This benchmark shows some of the impact as to get good granular scores it pushes you towards a more granular implementation. Especially note benchmarks around creation/removal: https://krausest.github.io/js-framework-benchmark/current.html

Thanks!! Creation speed escaped my attention.

from solid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.