Giter Site home page Giter Site logo

Comments (3)

kettanaito avatar kettanaito commented on May 18, 2024

Eventually, need to make sure we are memoizing a proper thing. The logic cannot be based on the input props in getAreasList, since a change in props doesn't guarantee the change in the template-* prop values.

Suggestions

  1. Perform filterTemplates(props). Takes in a props object, returns an object of template-* props.
  2. Invoke getAreasList(templateProps) with the result of filterTemplates function call (that means accepts only template-* props at the first place). Can be memoized based on the template props received.

Pros:

  • getAreasList has narrower input scale and can be memoized

Cons:

  • There is going to be a small iteration overlap equal to templatePropsLength, because both filterTemplate and getAreasList will iterate over a defined set of template props.

from atomic-layout.

kettanaito avatar kettanaito commented on May 18, 2024

This will have no performance effect whatsoever if parseTemplates is called in the constructor method. Moving parseTemplates into another lifecycle method is not desired as well, since layout declaration is not something you change during the component's lifecycle.

I would put this optimization task on hold unless there is a known performance issue.

from atomic-layout.

kettanaito avatar kettanaito commented on May 18, 2024

At the moment I see no reason to provide this optimization. Feel free to post some examples when dynamic layout ares would be applicable, but in my opinion this is something that is not meant to change during the component's lifecycle.

Closing for now.

from atomic-layout.

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.