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

Feat: Performance enhancements #281

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

fveracoechea
Copy link

@fveracoechea fveracoechea commented Apr 19, 2024

Description

Implement code optimizations on CVA to increase execution speed and reduce the number of operations, such as iterations and object copying.

Additional context

Let's say we have a web page made of React components, where most components utilize CVA.
Since React components render and re-render often, it's important to keep CVA's runtime overhead as low as possible. This optimization will enhance scalability, especially on large projects.

Benchmark results

pnpx ts-node ./packages/cva/src/benchmark.ts
(index) branch name ops/sec average (ms) samples
0 feat/performance-enhancement 440297 0.002 2201487
1 cva/main 125161 0.008 625810 3.52 x slower

image

All tests passing with no problems:

image

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Follow the Style Guide.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

Copy link

vercel bot commented Apr 19, 2024

@fveracoechea is attempting to deploy a commit to the cva Team on Vercel.

A member of the Team first needs to authorize it.

@fveracoechea fveracoechea changed the title Feat/performance enhancements Feat: Performance enhancements Apr 19, 2024
@fveracoechea fveracoechea marked this pull request as draft April 19, 2024 19:07
@fveracoechea fveracoechea marked this pull request as ready for review April 19, 2024 19:07
@joe-bell
Copy link
Owner

This is super thoughtful of you, thanks @fveracoechea 🙏❤️

Fairly busy at the moment and this will take some time to review, so don't be too disheartened if it takes some time to get around to this! Really appreciate it

@fveracoechea
Copy link
Author

Thanks @joe-bell 🙏 let me know if you have any suggestions or concerns, I’d be happy to help!

packages/cva/src/index.ts Outdated Show resolved Hide resolved
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