Performance Comparison Between Panda and Tailwind with CVA #1982
Replies: 3 comments 5 replies
-
hey, thanks for reporting this ! since Panda has to transform style objects to classes, it will always have a little bit of overhead vs just writing the final classes. that being said, a quick & easy fix is to cache the
it should be much better now and is in fact what I did here also, 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 |
Beta Was this translation helpful? Give feedback.
-
Thanks for reporting this @kris-ellery. In addition to what @astahmer mentioned, I should also add that the comparison is slightly uneven. The cva in Panda is equivalent to using cva = tailwind-merge + class-variant-authority We need to update the comparisons and measure the runtime diff again. That said, I'm certain there are areas in the code we can optimize further. |
Beta Was this translation helpful? Give feedback.
-
curious if there’s a discussion anywhere of a build time transpilation system for object hashing to strings and stuff, since i think most if that work is doable at build time. |
Beta Was this translation helpful? Give feedback.
-
Hi there!
I'm an big fan of Panda and have recently conducted performance comparisons against other CSS tools. My focus has been on component render times. I've found that Panda's runtime is notably slower than Tailwind when using
cva
equivalents.I've set up dummy Next 14 apps using React 18, each rendering 100 instances of a
Button
component. These instances vary insize
andtone
props. For performance insights, I utilized the React Profiler in DevTools' console, which records both the mount phase and the update phase triggered by a forced re-render button.Here are the links for reference:
Panda with its own
cva
Tailwind with
cva
(Class Variance Authority)From my tests, Tailwind with
cva
outperforms Panda by a factor of 2-3x. I'm unable to pinpoint the exact bottleneck in Panda. This performance gap makes me hesitant to recommend Panda for production environments, especially considering that extensive use of its features might further impact thestyled-system
size and slow down render times.I would greatly appreciate any insights or suggestions to enhance Panda's render performance. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions