Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:104.0) Gecko/20100101 Firefox/104.0
Firefox 104
Linux
Desktop
2 years ago
Test name Executions per second
classnames 2158351.8 Ops/sec
clsx 3441581.8 Ops/sec
Array based 2030312.9 Ops/sec
String based (return struct) 3171138.2 Ops/sec
String based (if-else struct) 3206107.5 Ops/sec
Entries, filter, map, join 2627531.8 Ops/sec
String literally 1372524160.0 Ops/sec
Recursive tagged template literal 791627.2 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

  • Recursive tagged template literal