Giter VIP home page Giter VIP logo

fulcro-garden-css's People

Contributors

awkay avatar eneroth avatar holyjak avatar maxthoursie avatar timovanderkamp avatar wilkerlucio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fulcro-garden-css's Issues

[Performance] Large component trees should not walk down duplicate branches for css includes

We have a large component tree, 7425 nodes are found by css-injection/find-css-nodes of which 218 are unique.

The code currently walks down the complete ast-tree and then uses distinct to get to the 218 unique nodes that have css.

Recursion can be aborted early when a path has been traced before.

Adding a cache results in this performance increase for us:

Without aborting recursion early:

 (time (do (css-injection/find-css-nodes-old {:component Root})
           nil))
 {:nodes 7425, :unique 218}
 "Elapsed time: 157.835000 msecs"
 => nil
 (time (do (css-injection/find-css-nodes-old {:component Root})
           nil))
 {:nodes 7425, :unique 218}
 "Elapsed time: 155.275000 msecs"
 => nil
 (time (do (css-injection/find-css-nodes-old {:component Root})
           nil))
 {:nodes 7425, :unique 218}
 "Elapsed time: 159.910000 msecs"
 => nil

With aborting recursion early:

 (time (do (css-injection/find-css-nodes {:component Root})
           nil))
 {:nodes 235, :unique 218}
 "Elapsed time: 60.525000 msecs"
 => nil
 (time (do (css-injection/find-css-nodes {:component Root})
           nil))
 {:nodes 235, :unique 218}
 "Elapsed time: 69.570000 msecs"
 => nil
 (time (do (css-injection/find-css-nodes {:component Root})
           nil))
 {:nodes 235, :unique 218}
 "Elapsed time: 65.270000 msecs"
 => nil

Does not create styles unless Root component has a query

The snippet below will create an empty style tag.

(defsc Root [this props]
  {:css [[:body {:margin 0}]]}
  (dom/div
    (inj/style-element {:component Root})
    (dom/div "TODO")))

Relatedly, even if a query exists, changes to the root css will not take effect on hot reload. Only child components referenced via query will have updated styles on hot reload.

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.