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

perf: improve runtime performance #1986

Merged
merged 5 commits into from
Jan 12, 2024
Merged

perf: improve runtime performance #1986

merged 5 commits into from
Jan 12, 2024

Conversation

astahmer
Copy link
Collaborator

Closes #1982

📝 Description

Improve the performance of the runtime transform functions by caching their results (css, cva, sva, recipe/slot recipe,
patterns)

since Panda has to transform style objects to classes ({ backgroundColor: "red.300" } -> bg_red, it will always have a little bit of overhead vs just writing the final classes, caching those reduce the time spent on it.

💣 Is this a breaking change (Yes/No):

no

📝 Additional Information

if you're using anything that can pre-render to HTML (Astro, RSC, etc) you can avoid this issue entirely by automatically inlining classes at build-time, without ever needing those runtime functions

Copy link

changeset-bot bot commented Jan 10, 2024

🦋 Changeset detected

Latest commit: 1db635f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@pandacss/generator Patch
@pandacss/shared Patch
@pandacss/fixture Patch
@pandacss/node Patch
@pandacss/parser Patch
@pandacss/dev Patch
@pandacss/config Patch
@pandacss/core Patch
@pandacss/studio Patch
@pandacss/token-dictionary Patch
@pandacss/astro-plugin-studio Patch
@pandacss/postcss Patch
@pandacss/error Patch
@pandacss/extractor Patch
@pandacss/is-valid-prop Patch
@pandacss/logger Patch
@pandacss/preset-atlaskit Patch
@pandacss/preset-base Patch
@pandacss/preset-open-props Patch
@pandacss/preset-panda Patch
@pandacss/types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jan 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
panda-docs ✅ Ready (Inspect) Visit Preview Jan 12, 2024 5:39pm
panda-playground ✅ Ready (Inspect) Visit Preview Jan 12, 2024 5:39pm
panda-studio ✅ Ready (Inspect) Visit Preview Jan 12, 2024 5:39pm

@segunadebayo
Copy link
Member

segunadebayo commented Jan 11, 2024

Great work! Did some performance comparisons, rendering 100 instances of a component using cva.

Before
CleanShot 2024-01-11 at 15 45 21@2x

After
CleanShot 2024-01-11 at 15 45 39@2x

Diff
Mount Time: 10.9s -> 3.6s (66.97%)
Update Time: 9s -> 4.8s (46.67% difference)

@cschroeter
Copy link
Member

Mount Time: 10.9s -> 3.6s (100.69% improvement)
Update Time: 9s -> 4.8s (60.8696% difference)

Those improvements in percentage look a bit off. Imho it should be 66.97% faster for mounting and 46.67% for updating ?!

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.

3 participants