Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
clsx vs cx
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Browser:
Chrome 124
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
clsx
6578232.5 Ops/sec
cx
1515056.4 Ops/sec
HTML Preparation code:
<script src='https://unpkg.com/clsx@1.1.0/dist/clsx.min.js'></script>
Tests:
clsx
var str = 'style'; var obj = { 'style-2': true, 'style-3': false, 'style-4': true, } var arr = ['style-5', 'style-6'] let result = window.clsx(str, obj, arr, 'test classname')
cx
var str = 'style'; var obj = [ true && 'style-2', false && 'style-3', true && 'style-4', ] var arr = ['style-5', 'style-6'] const cx = (...args) => args .flat() .filter(x => x !== null && x !== undefined && typeof x !== 'boolean' ).join(' ') let result = cx(str, obj, arr, 'test classname')