Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
Chrome 97
Windows
Desktop
2 years ago
Test name Executions per second
classnames 1467087.4 Ops/sec
clsx 1845392.4 Ops/sec
array, filter(Boolean), join 1255639.5 Ops/sec
array, filter(i => i), join 1990671.0 Ops/sec
forEach, join 2132043.0 Ops/sec
forEach, += 2861391.5 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests:
  • classnames

  • clsx

  • array, filter(Boolean), join

  • array, filter(i => i), join

  • forEach, join

  • forEach, +=