Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Classnames vs CLSX vs light-classnames on string concatenation
(version: 1)
In doing my new package light-classnames. I'm trying to see if my package is faster than the other two major competitors/
Comparing performance of:
classnames vs clsx vs light-classnames
Created:
one year ago
by:
Guest
Go to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/classnames/2.2.6/index.min.js"></script> <script src="https://unpkg.com/clsx@1.1.0/dist/clsx.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/light-classnames@0.0.3/dist/bundle.umd.min.js"></script>
Script Preparation code:
var str = 'style'; var obj = { 'style-2': true, 'style-3': false, 'style-4': 9, 'style-5': null }; var number = 6; var anotherStr = 'jigucha'; var moreObject = {a: undefined, b: 'asdf'}
Tests:
classnames
let result = window.classNames(str, anotherStr)
clsx
let result = window.clsx(str, anotherStr)
light-classnames
let result = window.lcn(str, anotherStr)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
classnames
clsx
light-classnames
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.3.1 Safari/605.1.15
Browser/OS:
Safari 26 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
light-classnames
217.0M/s
clsx
105.8M/s
classnames
36.8M/s
View exact numbers
Test name
Executions per second
✓
light-classnames
216,996,384 Ops/sec
clsx
105,812,160 Ops/sec
classnames
36,831,740 Ops/sec
Related benchmarks
clsx string vs array vs object
Classnames vs CLSX vs Template Literals 2/28/2023
Classnames vs CLSX vs Alternatives 03.25.2024
Classnames vs CLSX vs Alternatives 2024-05-20
Classnames vs CLSX vs Alternatives - flat array
Comments
Confirm delete:
Do you really want to delete benchmark?