Skip to content

Comments

perf(tailwind): optimize rendering pipeline with caching#2970

Open
Ray0907 wants to merge 1 commit intoresend:canaryfrom
Ray0907:perf/tailwind-caching-layer
Open

perf(tailwind): optimize rendering pipeline with caching#2970
Ray0907 wants to merge 1 commit intoresend:canaryfrom
Ray0907:perf/tailwind-caching-layer

Conversation

@Ray0907
Copy link

@Ray0907 Ray0907 commented Feb 20, 2026

Optimize the Tailwind rendering pipeline without changing
public API.

  • Batch class collection with Set dedup, call addUtilities once (N compiler.build()
    → 1)
  • Cache parsed CSS AST with clone() on read to skip redundant parse() calls
  • Walk rule.prelude instead of entire rule subtree, early exit for non-matching rules
  • Add LRU eviction (max 50) to useSuspensedPromise to cap memory on long-running
    servers

Summary by cubic

Optimized the Tailwind rendering pipeline to remove redundant builds and CSS parsing, and added an LRU cache for suspended promises to reduce memory on long-running servers. No public API changes.

  • Refactors
    • Batch and dedupe class names, then call addUtilities once per render.
    • Cache parsed CSS AST in setupTailwind and return a clone to avoid extra parse calls.
    • Walk rule.prelude only in extractRulesPerClass with early exit for non-matching rules.
    • Add LRU (max 50) to useSuspensedPromise to cap memory usage.

Written for commit d843955. Summary will update on new commits.

…m improvements

- Batch class collection and deduplicate before single addUtilities call (N compiler.build → 1)
- Cache parsed CSS AST in setup-tailwind with clone-on-read to avoid redundant parsing
- Walk rule.prelude instead of entire rule in extractRulesPerClass with early exit for non-matching rules
- Add LRU eviction (max 50) to useSuspensedPromise to prevent unbounded memory growth
@vercel
Copy link

vercel bot commented Feb 20, 2026

@Ray0907 is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link

changeset-bot bot commented Feb 20, 2026

⚠️ No Changeset found

Latest commit: d843955

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 20, 2026

Open in StackBlitz

npm i https://pkg.pr.new/resend/react-email/@react-email/tailwind@2970

commit: d843955

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

@Ray0907 Ray0907 changed the title perf(tailwind): optimize rendering pipeline with caching and algorith… perf(tailwind): optimize rendering pipeline with caching Feb 20, 2026
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