lukeed/clsxPublic

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

v1.0.4

LUlukeed published af19571Immutable

Release notes

## Patches

- Ignore function arguments: 4aff569

- Separate Array and Object loops: 91f5e68

While this did add ~20 bytes to the package (which is a 10% size increase), it made _any_ Array interactions 200% to 600% faster! 🎉 Below is a performance comparison between `clsx@1.0.3` and `clsx@1.0.4` running on Node v10.13.0:

``` # Strings clsx (prev) x 10,661,038 ops/sec ±0.46% (92 runs sampled) clsx x 11,066,632 ops/sec ±0.23% (96 runs sampled)

# Objects clsx (prev) x 6,934,269 ops/sec ±0.23% (94 runs sampled) clsx x 7,147,168 ops/sec ±0.30% (95 runs sampled)

# Arrays clsx (prev) x 1,681,568 ops/sec ±0.32% (97 runs sampled) clsx x 7,922,225 ops/sec ±0.18% (95 runs sampled)

# Nested Arrays clsx (prev) x 940,741 ops/sec ±0.33% (96 runs sampled) clsx x 6,132,222 ops/sec ±0.49% (95 runs sampled)

# Nested Arrays w/ Objects clsx (prev) x 1,428,975 ops/sec ±0.15% (95 runs sampled) clsx x 5,156,844 ops/sec ±0.22% (95 runs sampled)

# Mixed clsx (prev) x 2,198,907 ops/sec ±0.34% (98 runs sampled) clsx x 5,577,715 ops/sec ±0.20% (93 runs sampled)

# Mixed (Bad Data) clsx (prev) x 1,038,752 ops/sec ±0.32% (94 runs sampled) clsx x 1,887,010 ops/sec ±0.14% (96 runs sampled) ```

## Chores

- Include Node.js benchmarks: b7c3973 - Update benchmark results: 8d5a2f7, e85c5be - Fix README typos: ead41a3, 4a4413d - Update size: a0fd98a

Attached at publication

## Patches

- Ignore function arguments: 4aff569

- Separate Array and Object loops: 91f5e68

While this did add ~20 bytes to the package (which is a 10% size increase), it made _any_ Array interactions 200% to 600% faster! 🎉 Below is a performance comparison between `clsx@1.0.3` and `clsx@1.0.4` running on Node v10.13.0:

``` # Strings clsx (prev) x 10,661,038 ops/sec ±0.46% (92 runs sampled) clsx x 11,066,632 ops/sec ±0.23% (96 runs sampled)

# Objects clsx (prev) x 6,934,269 ops/sec ±0.23% (94 runs sampled) clsx x 7,147,168 ops/sec ±0.30% (95 runs sampled)

# Arrays clsx (prev) x 1,681,568 ops/sec ±0.32% (97 runs sampled) clsx x 7,922,225 ops/sec ±0.18% (95 runs sampled)

# Nested Arrays clsx (prev) x 940,741 ops/sec ±0.33% (96 runs sampled) clsx x 6,132,222 ops/sec ±0.49% (95 runs sampled)

# Nested Arrays w/ Objects clsx (prev) x 1,428,975 ops/sec ±0.15% (95 runs sampled) clsx x 5,156,844 ops/sec ±0.22% (95 runs sampled)

# Mixed clsx (prev) x 2,198,907 ops/sec ±0.34% (98 runs sampled) clsx x 5,577,715 ops/sec ±0.20% (93 runs sampled)

# Mixed (Bad Data) clsx (prev) x 1,038,752 ops/sec ±0.32% (94 runs sampled) clsx x 1,887,010 ops/sec ±0.14% (96 runs sampled) ```

## Chores

- Include Node.js benchmarks: b7c3973 - Update benchmark results: 8d5a2f7, e85c5be - Fix README typos: ead41a3, 4a4413d - Update size: a0fd98a

Assets 0
None were attached at publication.
No assets.

Shipped in this Release 0

None

Deployments 0

  • None

History 0

No Decisions yet.