Run details:
Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.2 Mobile/15E148 Safari/604.1
Mobile Safari 15
iOS 15.2.1
Mobile
2 years ago
Test name Executions per second
classcat(arr) 1301119.5 Ops/sec
classcat(obj) 1969741.4 Ops/sec
clsx(arr) 1666187.5 Ops/sec
clsx(obj) 2048807.2 Ops/sec
objstr(obj) 2002987.0 Ops/sec
arr.filter(Boolean).join(" ") 1541669.1 Ops/sec
merge-class-names(arr) 887899.7 Ops/sec
merge-class-names(obj) 1278298.9 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)