dcastil
tailwind-merge
BlogDocsChangelog

additional optimizations

#619Merged
Comparing
quantizor:further-improvements
(
1bafc9c
) with
main
(
57372fa
)
CodSpeed Performance Gauge
+1%
Untouched
5
New
2

Benchmarks

New

ultra long class list with many conflicts without cache
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
N/A
N/A16.1 ms
ultra long class list with many conflicts with cache
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
N/A
N/A16.1 ms

Passed

collection without cache
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
+5%
202 ms193 ms
collection with cache
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
+2%
17.3 ms16.9 ms
simple
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
0%
3.9 ms3.9 ms
heavy
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
0%
4.2 ms4.2 ms
init
tests/tw-merge.benchmark.ts::twMerge
CodSpeed Performance Gauge
0%
5.1 ms5.1 ms

Commits

Click on a commit to change the comparison range
Base
main
57372fa
+1.69%
perf: pre-compute conflict arrays at initialization Pre-compute conflict arrays in Maps at initialization time instead of concatenating arrays at runtime on every call to getConflictingClassGroupIds. Architectural improvement: - Build conflictsWithoutPostfix Map for all class groups with conflicts - Build conflictsWithPostfix Map with pre-merged arrays for classes that have both base conflicts and modifier conflicts - Eliminates runtime concatArrays() calls, replacing with O(1) Map lookups This moves work from the hot path (called for every Tailwind class) to initialization time (called once). The concatArrays operation was creating new arrays and copying elements on every conflict check. Benchmark results show ~2.6% improvement on 'collection without cache' (from 114.02 hz to 116.97 hz).
7831c8e
3 months ago
by quantizor
-0.34%
test: add ultra long class list benchmark Add benchmark for ultra long class lists with many conflicts to demonstrate performance characteristics with large class sets.
1927858
2 months ago
by quantizor
0%
revert: remove array-based string building optimization The optimization provides no benefit since the function is only called with >1 strings, making the array-based approach unnecessary overhead.
0799c12
2 months ago
by quantizor
0%
Make benchmark test names consistent
1bafc9c
2 months ago
by dcastil
© 2026 CodSpeed Technology
Home Terms Privacy Docs