Skip to content

perf(cache): keep the common compound value checks small in compareSnapshot - #329

Open
g4lb wants to merge 1 commit into
heroui-inc:mainfrom
g4lb:perf-compound-compare-split
Open

g4lb wants to merge 1 commit into
heroui-inc:mainfrom
g4lb:perf-compound-compare-split

Conversation

@g4lb

@g4lb g4lb commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Description

matchValue now checks only primitives and primitive arrays. Objects and JSON text go to matchStructured. The output does not change.

Built dist, µs per loop, 20 rounds, Mann-Whitney test (Node 24, Apple M2 Max):

Benchmark Before After Change
40 compound variants 908 776 −14.6%
compound slots, class objects 219 200 −8.4%
12 compound variants 58.0 55.4 −4.5%
button, same props 54.2 52.3 −3.6%
button calls, twMerge: false 59.4 57.8 −2.6%
mixed page 17.6 17.2 −2.1%

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Performance impact

  • This change is not performance-sensitive.
  • I ran the full pnpm benchmark suite and reviewed the current TV versus released TV results.
  • Any confirmed regression above 5% is documented and intentionally bounded.

Full pnpm benchmark: compounds-heavy −7.7%, many-compounds −4.1%. Some utilities rows moved by up to ±12%. This change does not touch their code.

Tests, tsc, biome and the build pass. Outputs matched on 1M random configs.

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).
  • Confirm that performance-sensitive changes follow the benchmark requirements.

@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/tailwind-variants@329

commit: fd10afe

This branch has not been deployed

No deployments
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.

1 participant