lukeed/clsxPublic

A tiny (239B) utility for constructing `className` strings conditionally.

Could default exported function perform a tiny bit better?

RE

```diff export default function () { - var i=0, tmp, x, str=''; + var tmp, x, len=arguments.length, str='', i=0; - while (i < arguments.length) { + while (i < len) { if (tmp = arguments[i++]) { if (x = toVal(tmp)) { str && (str += ' '); str += x } } } return str; } ```

Benchmark on only string concatenation shows an increase of about 1,000,000 operation/sec. **Note:** I got benchmark results only in node, in a really inaccurate way. but theoretically, it must increase the performance.

  1. LU

    Hey, thanks!

    This is already done in #26 – I haven't been able to setup a clean bench environment to test this out yet. Caching a `foo.length` used to not matter, but it may very well matter once again.

    It's on my TODO list to go through these PRs.

  2. naveen1337subscribed5 years ago on GitHub

  3. naveen1337subscribed5 years ago on GitHub

  4. HO

    Any news on this?

  5. yordisreferenced this in feat: enhance performance #263 years ago on GitHub

  6. LU

    This was addressed & merged in the linked PR. Thanks

  7. lukeedclosed2 years ago on GitHub