Skip to content

Performance: Variables, or Binding? #82

Answered by WorldSEnder
simbleau asked this question in Q&A
Discussion options

You must be logged in to vote

I believe letting the browser handle the vars and rebinding thereof is slightly faster:

  • no need to re-render any components that consume the vars
  • no need for the browser to re-traverse the dom if occurrences of variables are marked in the first pass. It will need to re-render the influenced parts of the dom either way.

That being said, it can be more ergonomic to let each component build its style dynamically instead of setting a ton of variables at the top level. For a small number of colors though, e.g. --dark-primary, --darker-primary, --primary or what have you, variables still work, but when you also includes things like margin sizes, shadows, grid sizes and all the other things, v…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by simbleau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #79 on July 13, 2022 22:28.