Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36
Chrome 98
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
classcat(arr) 3118946.2 Ops/sec
classcat(obj) 6026430.5 Ops/sec
clsx(arr) 5578954.5 Ops/sec
clsx(obj) 6318887.5 Ops/sec
objstr(obj) 6153347.0 Ops/sec
arr.filter(Boolean).join(" ") 3266141.0 Ops/sec
merge-class-names(arr) 3193133.5 Ops/sec
merge-class-names(obj) 3541604.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • classcat(arr)

  • classcat(obj)

  • clsx(arr)

  • clsx(obj)

  • objstr(obj)

  • arr.filter(Boolean).join(" ")

  • merge-class-names(arr)

  • merge-class-names(obj)