Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
classNames vs clsx - strings only
classNames vs clsx - strings only
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/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
clsx
4467799.0 Ops/sec
classNames
3689657.2 Ops/sec
HTML Preparation code:
<script src='https://unpkg.com/clsx@2.1.1/dist/clsx.min.js'></script> <script> window.classNames = (...classes) => { return classes.filter(Boolean).join(" "); }; </script>
Script Preparation code:
var str = 'style'; var condition1 = true ? 'true-string-1' : 'false-string-1'; var condition2 = true && 'true-string-2'; var condition3 = false && 'false-string-3';
Tests:
clsx
let result = window.clsx(str, condition1, condition2, condition3, 'test classname')
classNames
let result = window.classNames(str, condition1, condition2, condition3, 'test classname')