Cnfast
A 3.2x faster drop-in replacement for
cnon the project's benchmark mean, with byte-identical output toclsx+tailwind-merge. By Aiden Bai (Million.js / Security and Review Skills). Source: X/@aidenybai, 2026-06-20; GitHub README, 2026-06-30
What it is
cn() (clsx + tailwind-merge) runs on every styled component render; in large UIs it can become a measurable hot path. cnfast is an API-compatible implementation you swap in without changing call sites. Migrate with one command:
npx cnfast migrate
For shadcn/ui projects, the registry route rewrites the local lib/utils.ts helper to re-export cnfast and installs the package:
npx shadcn@latest add aidenybai/cnfast/cn
The README reports a 3.17x geometric mean across 65 workloads, no mismatches across 30,127 real-world call groups, and 9.04 KB gzipped versus 8.45 KB for the baseline. The tagged-template form caches by call-site identity and can be faster on stable re-render sites. Source: GitHub README, 2026-06-30
Version and safety snapshot
| Check | Result |
|---|---|
| npm | cnfast@0.0.8, latest tag, published 2026-06-22 |
| GitHub | aidenybai/cnfast, default branch main at 0289d4cf1e119a3f9312b88834e20990f1b07d1e, pushed 2026-06-22 |
| Releases/tags | No Git tags found; use npm version plus commit snapshot |
| Stars | 1,035 as of 2026-06-30 |
| Brin repo scan | score=65, verdict=caution, medium confidence, pending deep scan |
Source: npm registry, GitHub API / git ls-remote, Brin API, 2026-06-30
Where it fits
A micro-optimization for shadcn/Tailwind React apps where class merging appears in hot render paths: live dashboards, data grids, virtualized lists, frequently updating cards, or server-rendered pages with large trees. Pairs with Security and Review Skills (same author; React code health) and the polish layer in Frontend and Design Skills.
Do not automatically migrate every repo. Check baseline dependencies, run existing visual tests, and treat the Brin caution as a reason to review the package diff before adoption. For small mostly-static surfaces, the performance win can disappear into noise.
Timeline
- 2026-06-24 | Follow-up commit/post claimed ~4x faster performance and linked the associated PR/commit. Source: X/@aidenybai, 2026-06-24
- 2026-06-22 | Captured from Kevin's X bookmark (@aidenybai, 2026-06-20) during the skill-coverage re-scan. Routed in the Frontend/React section. Source: X/@aidenybai, 2026-06-20; github.com/aidenybai/cnfast
- 2026-06-30 | Deep-reviewed original launch artifact and local screenshot; refreshed source snapshot to
cnfast@0.0.8, GitHub HEAD0289d4cf1e119a3f9312b88834e20990f1b07d1e, 1,035 stars, no tags, Brin repo caution/pending. Source: X bookmark artifact audit, 2026-06-30 - 2026-06-30 | One-by-one artifact review inspected the follow-up 4x benchmark screenshot and associated commit; no new skill needed because adoption remains a project-specific package swap after React/visual tests. Source: X/@aidenybai, 2026-06-22