Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize for the common case #17

Merged
merged 12 commits into from
Jul 10, 2023
Merged

Optimize for the common case #17

merged 12 commits into from
Jul 10, 2023

Conversation

dhleong
Copy link
Owner

@dhleong dhleong commented Nov 2, 2022

This PR implements the proposals in #10 to optimize for the common case of referentially-transparent style factory functions. I was able to keep the manual :key support by updating style factories to skip CSS compilation when nil is passed as the style name. In addition, style factories no longer have to be invoked with apply, passing params as a vector and then individually after; we just unpack the params vector via a let in the generated code.

There are some breaking changes to the StyleContainer protocol, but I would imagine that is a fairly transparent change to most clients.

  • Generate a memoized function for computing a style's name
  • Use the newly-generated naming fn; improve manual :key support
  • Clean up
  • Prepare to only conditionally compile CSS, update DOM
  • Respect global :always-compile-css?
  • Add support for :always-compile-css per-function escape hatch
  • Clean up some TODOs
  • Change StyleContainer to support skipping compile when mounted
  • Invoke style-factory directly, without apply

@dhleong dhleong linked an issue Nov 3, 2022 that may be closed by this pull request
@dhleong dhleong merged commit 5197e54 into main Jul 10, 2023
1 check passed
@dhleong dhleong deleted the dhleong/must-go-faster branch July 10, 2023 02:27
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Further optimize for the expected case of "pure" style functions
1 participant