Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.61 Safari/537.36
Chrome 102
Linux
Desktop
2 years ago
Test name Executions per second
classnames 1546029.5 Ops/sec
clsx 2276521.0 Ops/sec
Array based 1686492.6 Ops/sec
String based (return struct) 2263616.8 Ops/sec
String based (if-else struct) 2402376.8 Ops/sec
Entries, filter, map, join 1903689.9 Ops/sec
String literally 938471168.0 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • classnames

  • clsx

  • Array based

  • String based (return struct)

  • String based (if-else struct)

  • Entries, filter, map, join

  • String literally