{"repo":"aidenybai/cnfast","free":true,"listed":false,"github":"https://github.com/aidenybai/cnfast","clone":"git clone https://github.com/aidenybai/cnfast.git","description":"Fast drop in replacement for `cn`","language":"TypeScript","stars":1177,"topics":["clsx","cn","tailwindcss"],"license":null,"category":"workflow-automation","readme_excerpt":"cnfast Fast drop-in replacement for cn . cnfast runs 3.8x faster on average than tailwind-merge , up to 7x on component-heavy code, with byte-identical output. Same API, no code changes. Install Migrate an existing clsx , classnames , or tailwind-merge project in one command: On a shadcn/ui project, add or replace your cn utility through the registry. This rewrites lib/utils.ts to re-export cnfast and installs the package: Usage Swap the shadcn/ui cn helper for cnfast: cnfast also exports clsx , twMerge , and twJoin . Tagged templates As a tagged template, cn caches by call-site identity, skipping the join and hash on every repeat. A stable call site runs 4.3x faster than tailwind-merge . The cn(...) call form already caches its arguments on V8, so on that engine the template form is only 1.2x ahead; the gap is wider on engines without that cache. Comparing against cn cnfast produces byte-identical output to tailwind-merge and computes it faster, with the largest gains on re-rendering call sites where the same class arguments recur: Across the wider suite, operations per second on V8 (Node and Chrome), best-of-3: Workload tailwind-merge cnfast Speedup ------------------ --------------------- ------------ -------- Cached re-render 2,025 ops/s 8,709 ops/s 4.3x Merge engine, cold 1,440 ops/s 5,411 ops/s 3.8x Component corpus 1,585 ops/s 6,506 ops/s 4.1x Page render 4,249 ops/s 11,908 ops/s 2.8x Live data grid 500 ops/s 2,185 ops/s 4.4x Across 65 workloads the geometric mean is 3","default_branch":null,"files":null,"tree":[],"storefront":"/r/aidenybai","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/aidenybai/cnfast/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}